Reverse Proxy x Shopify

We're transitioning to Shopify but facing limitations in checkout, payments, and currency handling. So, separate stores are needed for each region: US (USD), UK (GBP), EU (EUR). Traditionally, these would be on subdomains: US: domain.com EU: eu.domain.com UK: uk.domain.com For better SEO and user experience, we prefer subdirectories: US: domain.com/us/ EU: domain.com/eu/ UK: domain.com/uk/ Despite this, three Shopify stores remain (us.domain.com, eu.domain.com, uk.domain.com). Idea is to use Cloudflare Workers as reverse proxy. Prototype works for general content but not Shopify sites, throwing "You do not have permission to access this website." We suspect Cloudflare's dual interaction with Shopify might create constraints due to "orange-to-orange" (O2O) conflicts. Finding detailed insights has been a challenge. Any resources on these constraints? Is our plan as described above even feasible?
2 Replies
diemar27
diemar27•15mo ago
I was trying to do a similar with with substack, managed to get it working with the main page, but the challenge with this reverse-proxying is that you need to pass through all headers and rewrite all urls. The permission issue might be related to passing through all headers from client to origin server. You can see some examples from people on Github https://github.com/octivi/cloudflare-reverse-proxy/blob/main/src/index.ts
GitHub
cloudflare-reverse-proxy/src/index.ts at main · octivi/cloudflare-r...
Cloudflare Workers as a reverse proxy. Route traffic from a (sub)domain to a subdirectory using Cloudflare Workers. Parse and transform URLs in HTML. - octivi/cloudflare-reverse-proxy
Gasper
GasperOP•15mo ago
Thank you @diemar27 I'm expecting some issues, especially because it's not just displaying static content but we need full-fledget communication between the client and the server through proxy. Even though chances to make this work are slim, I don't want to give up on the idea just yet 🙂
Want results from more Discord servers?
Add your server