Is it possible to reverse proxy a subfolder to a third party using Cloudflare?

As the title mentions, I need to know if it is possible to reverse proxy a subdirectory of a domain hosted on Cloudflare, to a third party service that stores certain resources, so that when a user visits mywebsiteDOTcom/subfolder they will be directed to the resource hosted by the third party but without changing the initial domain.

If so, how would I go about doing that? Thanks!

No, it’s not possible. Use a subdomain for that.

Why would you say that?

You would do it the same way you would if you weren’t using Cloudflare. Configure the reverse proxy on the desired path on your origin server.

Oh, I thought he don’t want the subfolder path proxied, hence the query.

Is there a tutorial that describes how to do this?

So If Cloudflare was my zone, on different subdomains they could point to different Vercel or Heroku or AWS sites?

I am not clear on your requirement. Do you want to reverse proxy a subfolder or a subdomain using a different service?

or you just want to host different content on a different URL on a different server/service, I would suggest using subdomain for it. You can add a subdomain with a different IP in the DNS entries.

The requirement was that there is a website, in which the client wants a subfolder that will display a third party resource as if the resource were hosted on the website itself. I read something somewhere about using page rules for this, but the explanation was very vague, and the exact situation for which the solution was provided wasn’t very clear.

Page Rules would redirect you to the other location unless you are on an Enterprise plan, as Host Header Override and Resolve Override are Enterprise only so the only option would be a 301/302 redirect with Forwarding URL.

The only option really, without Enterprise, is to put a Worker on the route /subfolder/* and have it fetch the path from the third party server.


This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.