Setting up geolocation with Cloudflare worker

To set up geolocation with a Cloudflare Worker:

  1. Log in to Cloudflare
  2. Click “Workers”, then “Manage Workers” and after the page reloads “Create a Worker”
  1. In the new window:
  1. Replace the script on the left (1) with this:
addEventListener("fetch", event => {
  const response = new Response(`{"country":"${event.request.headers.get("cf-ipcountry")}"}`, {
    headers: {
      "Access-Control-Allow-Origin": "*",
      "Content-Type": "application/json"
    }
  })
  
  event.respondWith(response)
})
  1. Click “Send” button (2) and then “Preview” (3).
    If you did everything correctly, you will see your country code on the screen, like {"country": "GB")
  2. Now click “Save and Deploy” button and copy the URL that you will see in a popup window.
  3. Paste this URL in the geolocation settings field in Full Picture’s settings panel

And you’re done!

Get a 50% early-bird discount and a chance to win a free licence?!

Subscribe to the launch notification