Rewrite/proxy /graphql path to other external domain

I would like to rewrite DOMAIN/graphql to OTHERDOMAIN/graphql.
This looks easy but I can’t find a rule for this.
Forwarding URL is a redirect, but I need a rewrite.
Under transform rules there is an URL rewrite option, but that’s only in the same domain?

That’s correct. What you’re looking for is more like domain masking. That would require a worker. There are a handful of posts on the topic.

ok, thanks.

I was trying to avoid cors overhead, but maybe the cors overhead is less then adding a worker.

You can run a worker on /graphql if you want to avoid CORS :slightly_smiling_face:
https://developers.cloudflare.com/workers/platform/routes

1 Like