Before you start
- 1.Your domain is already managed through Cloudflare (DNS proxied through Cloudflare).
- 2.Similar AI has provisioned your subdomain, e.g.
yourstore.page.similar.ai. If you have not received this, contact your Similar AI account manager. - 3.You have completed the new page onboarding checklist.
Step 1 - Create a Cloudflare Worker
- a.Go to
dash.cloudflare.comand navigate to Workers & Pages. - b.Click Create Application and set a name, for example
reverse-proxy. - c.Click Edit Code and paste the following script. Replace
client.comwith your domain andclient.page.similar.aiwith the subdomain Similar AI provisioned for you.
async function handleRequest(request) {
let url = new URL(request.url)
let target = ORIGINS[url.hostname]
if (target) {
url.hostname = target
return fetch(url, request)
}
return fetch(request)
}
addEventListener('fetch', event => {
event.respondWith(handleRequest(event.request))
})
const ORIGINS = {
'client.com': 'client.page.similar.ai',
}Double-check that you replaced client.com with your actual domain in the ORIGINS object before deploying.
Step 2 - Add a Workers Route
- a.In the Cloudflare dashboard, go to Workers Routes and click Add route.
- b.In the Route field, enter your domain followed by the folder path you want to use, for example:
yourstore.com/s/*. The trailing wildcard ensures all paths under that folder are proxied. - c.In the Worker dropdown, select the
reverse-proxyworker you created in Step 1. - d.Click Save.
How the proxy works
When a visitor requests a URL that matches your Workers Route (e.g. yourstore.com/s/blue-widgets), Cloudflare intercepts the request before it reaches your origin server. The Worker rewrites the hostname to your Similar AI subdomain and forwards the request. The response is returned to the visitor as if the page lived on your own domain.
This means your visitors see your domain in the address bar, search engines index the pages under your domain, and you keep full control of DNS and SSL through Cloudflare.
Request arrives
Visitor hits yourstore.com/s/blue-widgets
Worker rewrites hostname
Cloudflare forwards to yourstore.page.similar.ai
Page served under your domain
Visitor sees your URL, search engines index your domain
Not using Cloudflare?
If your site is not behind Cloudflare, you can achieve the same result with an Nginx reverse proxy. See the Nginx reverse proxy integration guide for instructions.
Ready to serve new pages under your domain?
Get started with Similar AI new pages. We handle page creation, content, and internal linking - you control how pages are served on your site.