Setting up geolocation with Cloudflare worker

Home » Support » Docs » 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”
cloudflare workers 1
  1. In the new window:
cloudflare workers 2
  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"
  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!

Give the free version a try!