SOQVER Prepare a source
English

Blog · Guide ·

Serve so4ag.json on your domain with a Cloudflare Worker

Serve so4ag.json at the root of your domain with a Cloudflare Worker and choose between bundling the file and reading it from an HTTPS address.

By convention, so4ag.json belongs at the root of your domain, where many website platforms give you no way to put a file. The SO4AG Worker answers /so4ag.json in front of your website, while your website continues to answer every other address as before.

What you need

Your domain’s DNS record must be proxied by Cloudflare, with the orange cloud switched on. A Worker route cannot run on a record set to DNS only. Check with your website platform first, since some hosted platforms require the proxy to be off.

You also need a Cloudflare account and Node.js 20 or newer if you deploy from the command line. Cloudflare’s documentation in November 2026 lists 100,000 requests per day on its free plan. The Worker is free, open source under Apache-2.0, and requires no SOQVER account. Worker code and manual

Choose where the source lives

Keep the file in the Worker

Use this option if your facts rarely change and you already keep them in a repository. Replace so4ag.json in the Worker folder with the source for your domain. When a fact changes, edit the file and deploy again.

Read the source from an HTTPS address

Use this option if someone edits and confirms the facts elsewhere. Set SOURCE_URL to the HTTPS address that returns the source. The Worker reads it and keeps the last good copy so it can serve the file during a temporary outage.

For a source managed at SOQVER, use https://soqver.com/s/YOUR-SOURCE/own/so4ag.json. This address becomes available once the company confirms the source and enters its domain in the source settings. It returns the published revision with identifiers on the company’s domain. With the default refresh interval, a change published in the administration reaches your domain within about five minutes without a new deploy.

When the remote source has a signature and a key alongside it, the Worker can also answer /so4ag.sig.json and /.well-known/so4ag-keys.json. Add routes for those paths if you want to expose them on your domain.

Deploy the Worker and add routes

From a checkout of the Worker folder, run these commands. The README also has a Deploy to Cloudflare button that copies the folder into your own repository and asks for the settings.

npm install
npx wrangler login
npx wrangler deploy

The first deployment gives you a preview address on workers.dev. To serve the file on your own domain, add the routes to wrangler.jsonc and run npx wrangler deploy again. Each route matches the host you write, so add a separate line for www if you serve both hosts. An example for Example Plumbing uses these routes.

{
  "routes": [
    { "pattern": "plumbing.example/so4ag.json", "zone_name": "plumbing.example" },
    { "pattern": "www.plumbing.example/so4ag.json", "zone_name": "plumbing.example" }
  ]
}

Worker settings

VariableWhat it controls
SOURCE_URLLeave empty to serve the file in the folder. Set an HTTPS address to read the source from there.
DOMAINThe domain the source belongs to. Leave empty to use the domain the Worker runs on.
REFRESH_SECONDSHow long to serve a copy before reading the remote source again. Default 300, minimum 60.
MAX_STALE_SECONDSHow long to serve the last good copy while the remote source is unreachable. Default 604800 (seven days). Set 0 to turn this off.

What the Worker refuses to serve

The Worker checks that the document has so4ag, id, and claims, and that both the source and publisher identifiers belong to the domain it serves. It ignores a leading www. when comparing domains. For Example Plumbing, an example source ID is https://plumbing.example/so4ag.json and the publisher ID is https://plumbing.example/#org. If the domains differ, the Worker returns an error naming both, so you can spot a source configured for the wrong site.

A remote document that fails these checks is never served, even if the Worker has an older good copy. A 404 or 410 stops the Worker from serving the source. It falls back to the last good copy only when there is no response or the remote server returns 429 or a 5xx status, and only within MAX_STALE_SECONDS.

Check the result

Open /so4ag.json on your domain and inspect the x-so4ag-worker response header. It reports embedded, fresh, cached, stale, or error. The Worker checks the document structure and domain. Validate the full source before publishing. Public validator

What stays outside the Worker

Next step

Check that your DNS record is proxied, then follow the deployment steps in the Worker manual.

More articles

Guide ·

How to publish your business facts on a WordPress site

Install SO4AG Facts on WordPress, add business details with conditions and dates, and publish a Facts and terms page you can check from the admin.

Guide ·

Turn WooCommerce shipping, payments, and returns into facts

Use SO4AG Facts to review WooCommerce shipping and payment suggestions, then add return periods, delivery times, and other terms by hand.

Guide ·

Shopify: How to publish facts and terms without an app

Learn how to publish a Facts and terms page on Shopify, add JSON-LD, and link to a hosted SO4AG file when you can't put the file at your store's domain root.

Free website audit All articles