Layer 7 Routing


#1

Continuing the discussion from Modify/Create Page over API?:

This is a feature I would love to have. Currently I have to either do the routing on my origin, or split the traffic over multiple hostnames.

www.example.com –> originwww.example.com
images.example.com –> originimages.example.com

L7 routing in CloudFlare would enable me to have
www.example.com/images/* –> originimages.example.com
www.example.com/* -> originwww.example.com

This is nice where bits of the overall website are run on different web servers, or different hosting providers. Temporary sites running on wpengine, or bits hosted statically on S3.

In a basic example, nothing else would change. In a more complicated scenario, the backend URL would be rewritten, and the responses altered also to maintain a single namespace. Such as example.com/site/ being served from something.wpengine.com/ (note the change in path), and needing to alter the body to ensure asset urls are correct. Even having ProxyPassReverse type functionality would be a start.


#2

Technically this does exist in Cloudflare today (It’s called Resolve Override), but it is only available in the ENT plan.

The only caveats to the feature vs.the example that you gave is that the path still needs to be the same for the requested resource and if it is pointing to an external host it has to be cnamed in your DNS.

www.example.com/images/* –> originimages.example.com/images/*

This can also be combined with another ENT feature (Host Header Override) to do some more complex mappings.

I definitely get the value of it though, can make it much more flexible and easier to maintain a site.


#3

Thanks @cscharff. I never knew Resolve Override existed, but that’s pretty much what I’m looking for from the documentation. Changing the path would be a bonus feature.