本文介绍了反向代理模式下的Apache拦截或陷阱后端服务器302响应,不发送302响应返回给客户端内部重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有谁知道如何告诉Apache在反向代理模式下,拦截或陷阱302(或30倍)从后端服务器响应,不发送响应30倍回客户内部重定向?
最终,响应重定向到后端服务器不会从外部进入(或在阿帕奇CONF未列出)。

Does anyone knows how to tell Apache, in reverse proxy mode, to intercept or trap 302 (or 30x) responses from backend server and redirect internally without sending 30x response back to client?Ultimately, the backend server the response is redirected to would not be accessible from the outside (or not listed in Apache conf).

我的情况:

我有web_server_A和web_server_B在端口6666和7777监听这些端口不能从外部访问,但是从内部访问。


我可以最终改变web_server_A的行为,但web_server_B的不是之一。


Apache是​​侦听端口80/443,从外部访问,并充当反向代理服务器发送请求给web_server_ {A,B} .example.com的到web_server_ {A,B}

My situation:
I have web_server_A and web_server_B listening on port 6666 and 7777. These ports are not accessible from outside, but are accessible from the inside.
I can eventually change the behavior of web_server_A, but not the one of web_server_B.
Apache is listening on ports 80/443, accessible from the outside and is acting as a reverse proxy sending requests addressed to web_server_{A,B}.example.com to web_server_{A,B}

客户端请求的Apache web_server_A.example.com/foo。阿帕奇将代理请求web_server_A这使得一些东西,然后发回给Apache的一个HTTP / 302响应指着web_server_B.example.com/bar/secret_token。阿帕奇发送回302响应于客户端,然后发送的Apache web_server_B.example.com/bar/secret_token一个HTTP请求。阿帕奇将代理请求web_server_B,这东西回复(通常它发回一些大的文件)。

The client asks Apache for web_server_A.example.com/foo. Apache proxies the request to web_server_A which makes some stuff and then sends back to Apache a HTTP/302 response pointing on web_server_B.example.com/bar/secret_token. Apache sends back the 302 response to the client which then sends Apache an HTTP request for web_server_B.example.com/bar/secret_token. Apache proxies the request to web_server_B, which replies something (usually it sends back some big file).

我的问题:

我不想让客户了解的URL web_server_B.example.com/bar/secret_token,最终我不想web_server_B能够从外部访问的。

My problem:
I don't want the client to know about the url web_server_B.example.com/bar/secret_token, and ultimately I don't want web_server_B to be accessible from outside.

web_server_A可以对web_server_B,然后发回从web_server_B答案,而无需发出302答复请求。但是,从web_server_B答案可能需要一段时间来,可能是相当大的,而且web_server_A不应该花太多时间上的任何请求(它用于处理大文件没​​有能力)。

web_server_A could make the request to web_server_B and then send back the answer from web_server_B without issuing a 302 reply. But, the answer from web_server_B might take some time to come, might be quite big, and web_server_A should not spend too much time on any request (it has no ability for handling big files).

于是,我想到了一个302捕兽功能,将现有要是好的,但到目前为止还没有基金如何做到这一点在网络上的任何东西。任何想法?

So I thought about a "302 trapper" feature that would be nice if existing, but so far haven't fund anything on the web on how to do that. Any idea?

推荐答案

使用ProxyPassReverse指令,web_server_A将修改由web_server_B发送Location头,所以客户端将无法了解他。

using ProxyPassReverse directive, web_server_A will modify Location header sent by web_server_B, so the client won't know about him.

捕获从上游服务器,你也可以编辑Location头重定向。比如头未设置位置将显示Apache的默认30X错误页面

to trap redirect from upstream server you can also edit Location header. For instance "Header unset Location" will show apache default 30X error page

这篇关于反向代理模式下的Apache拦截或陷阱后端服务器302响应,不发送302响应返回给客户端内部重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-24 06:07