开发者

Proxy Pass: follow redirect on server [closed]

Closed. This question is off-topic. It is not currently accepting answers.

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 10 years ago.

开发者_JAVA技巧 Improve this question

I'm using Apache ProxyPass to pass some requests from my server (1) to another (2). This works fine for most requests, but when server 2 processes a POST request and sends a redirect header, this is passed right through to the client, who then applies the redirect on server 1 and thus gets a 404.

So what I'd like is that server 1 (the server with the ProxyPass) follows redirects on server 2 and passes the final page back to the client.

I'm sure this must be a very common scenario, but I can't seem to find the solution. I'm imagining something like a "follow_redirects" flag, similar as you would apply to a curl client, but I haven't found anything like that. Maybe what I'm trying to do isn't the purpose of ProxyPass?

Could someone point me in the right direction here?

Thanks, Chris


Check out the ProxyPassReverse directive. With this set Apache can intercept redirects and rewrite them so the client doesn't leave the proxy. This will not process redirects on the proxy, but it will at least make the client send the redirected request back to your server instead of leaving you.


I found the Apache Traffic Server, which is a reverse-proxy made by Yahoo and given to the Apache foundation.

From this documentation:

Origin servers often send redirect responses back to browsers redirecting them to different pages. For example, if an origin server is overloaded, then it might redirect browsers to a less loaded server. Origin servers also redirect when web pages that have moved to different locations. When Traffic Server is configured as a reverse proxy, it must readdress redirects from origin servers so that browsers are redirected to Traffic Server and not to another origin server.

I haven't tried this yet, but there are packages for Debian, Ubuntu and CentOS.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜