To me, this seems like a simple scenario:
- Client makes request to reverse proxy at server
X
(http://proxy.example.com
) - Server
X
forwards request to backend serverY
(http://internal1.example.com:8000
) - Backend server
Y
responds with3xx
redirect to another backend serverZ
(http://internal2.example.com:8000
) - Proxy server
X
intercepts the 3xx redirect and makes the request again to backend serverZ
. It does not return the 3xx redirect back to the client. - Proxy server
X
responds to the client with the result of the redirected request from backend serverZ
.
I need this because some clients do not seem to handle the redirection (especially when doing PUT), so I would like the redirection to happen invisibly and internally on the proxy server. (I am actually running a WebDAV server on the backend, so my clients are Cyberduck, Nautilus, OSX Finder, etc).
I've searched a huge amount for an existing answer to this, but had no luck (this question is basically what I want, but there are no satisfactory answers and it's been inactive for a year. Hopefully things have changed since then).
I would like to use an existing soluion for this if possible. Is it possible with Apache/Nginx?
Best Answer
So after much more googling, and a chat with the apache guys on IRC, it seems to be impossible with apache. So I took a look at nginx, and managed to find a solution using
X-Accel-Redirect
with a configuration like the one at the end of this answer.See the relevant blog posts:
http://kovyrin.net/2006/11/01/nginx-x-accel-redirect-php-rails/