Can we use Cloudflare as a reverse proxy to a wordpress site?


#1

Hi there,

Suppose i have a website, and a wordpress site, hosted on different servers/domain names.

Now, I want www.mysite.com/blog to point to mysite.wordpress.com. Pretty common requirement i’m sure.

Normally we’d do this at the web server level, with a reverse proxy. (e.g IIS, NGINX, etc)

But - can we do this with Cloudflare, since it’s a reverse proxy anyway? I saw we can have “Page Rules” to rewrite URL’s, but that involves a temporary/permanent redirect. (which shouldn’t happen).

Any ideas?

Thanks!


#2

Wordpress.com subdomains check the host header to serve your website (instead of serving someone else’s website). Cloudflare as a reverse proxy does not change or overwrite this host header, instead making a request to the A/CNAME record with the host header sent from the browser.

This is mainly to prevent abuse of cloudflare, as being able to reverse proxy arbitrary domains while faking the host header could lead to PAAS applications (like wordpress.com) getting mad that Cloudflare is ruining/breaking their business model by allowing users to fake where a request is originating from (wordpress.com free plans don’t get a custom domain). This would also likely make some hosts mad, as a shared server effectively serving a copy of someone else’s domain would raise some red flags and the blame would be on Cloudflare for allowing it.

So currently, the only way to do this via Cloudflare itself is to be on the enterprise plan:

This is likely due to Cloudflare fully trusting that their enterprise customers won’t abuse it to get “custom domain”-like functionality on PAAS services for free, and if they do they can confront their customer about the behavior.

So without the enterprise plan, the best way to go about this is to set up this reverse proxy on your origin IIS/nginx/etc server.


#3

Thanks for your reply!

Damn, RE enterprise plan. We’re on Pro plan ($30/month). Can’t really justify going up two plans to Enterprise, just to do the rewrite.

Guess i’ll do it at the IIS level.

Thanks :slight_smile:


#4

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