/Documentation

How to configure the same origin domain for Shopify

Updated Oct 19, 2026

Note:

How to proxy the Shopify store domain

select your domain
Navigate to DNS → Records
Enable proxy status

How to configure the same origin domain for the Shopify Store

Note:

Note:

Step 1. Create a Cloudflare Worker

Start with Hello World!

Step 2. Name and deploy the worker

worker name

Step 3. Edit the worker code

export default { async fetch(request, env, ctx) { let { pathname, search, host } = new URL(request.url); pathname = pathname.replace('/metrics/', '/'); const domain = 'sst.shop.stapedesk.com'; let newRequest = new Request((`https://` + domain + pathname + search), request); newRequest.headers.set('Host', domain); return fetch(newRequest); }, };
Deploy and save your changes

Step 4. Add a route to the worker

Add a route to the worker

Step 5. Create a Configuration Rule

Create a Configuration Rule
Create rule

Step 6. Create a Request Header Transform Rule

Create a Request Header Transform Rule

Step 7. Update Custom Loader

Custom Loader

Step 8. Add the server container URL in the web and server GTM

server container URL in the web and server GTM
Server container URLs
Add client name
specify your Measurement ID
add the trigger for a tag

Testing your Same Origin setup

Testing your Same Origin setup
request from your website's real domain

Was this article helpful?

Comments

Can’t find what you are looking for?