Reverse Proxy Content

If I have a website that I’ve migrated to netlify called example.com

however, there is a reservation system built with PHP that is hosted somewhere else. I found that you can create a reverse proxy url that looks like this (in _redirects):

/reservations/* https://www.not-on-netlify.com/reservations/:splat 200

I visit the example.com/reservations and it is pulling the content from the remote site… Mind. Blown.

However - what is the catch? Is it useless in situations where the user has to login in? For example, if they log into the site will everyone else be able to see their content because netlify is caching the first user? In short - I’m trying to figure out why this looks like the solution to all my problems but will inevitably have some sort of “gotcha” that will destroy my hopes and dreams. :slight_smile: As a side note, I thought I was going to have to create a cloudflare worker / page rule that would capture traffic from /reservations and serve it from the not-netlify site.

Thanks for any insight on the limitations of this reverse proxying stuff!

Welcome back, @datx and sorry to be slow to get back to you!

Our reverse proxying delegates that decision to your remote service at not-on-netlify.com . You control the behavior by setting an appropriate Cache-Control http response header on that service; our cache obeys it. If you have a login-based system, you’ll definitely want to ensure we DON’T cache it. That’s the “de facto default” if you set nothing (and thus we set nothing), but you should probably specify it on that remote service to be safe (we cannot CHANGE the setting that the remote system has set, so you do have to set it there, rather than here! The custom headers feature seem like it might help here, but it DOES NOT get applied to proxy’d content, delegating the decision to your service.

Despite working for Netlify, I am pragmatic and I do not see any gotchas with proxying to that service - that’s what the feature is designed to do!

Glad you’re finding the feature interesting :smiley: