apache RewriteRule, Proxy 指令 [P] - 是否可以使请求使用实际的代理主机?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/575077/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 17:18:17  来源:igfitidea点击:

RewriteRule, Proxy directive [P] - Is it possible to make request use actual proxy host?

apachemod-rewritemod-proxy

提问by

Does anyone know whether it is possible to make rewrite rules which use the proxying [P] directive, as shown below, to behave like ProxyPassused in conjunction with ProxyPreserveHost Off.

有谁知道是否可以使使用代理 [P] 指令的重写规则(如下所示)表现得像ProxyPassProxyPreserveHost Off.

In other words I want the server on mydomain.net to see a request for mydomain.net not mydomain.com.

换句话说,我希望 mydomain.net 上的服务器看到对 mydomain.net 而不是 mydomain.com 的请求。

RewriteCond  %{HTTP_HOST} ^mydomain.com$  [NC]
RewriteRule ^/(.*)$  http://mydomain.net/app1/ [P,L]


Thanks and best regards,


谢谢和最好的问候,

采纳答案by chaos

Since [P] actually uses mod_proxy, I'd try setting ProxyPreserveHost off and seeing if that does it.

由于 [P] 实际上使用 mod_proxy,我会尝试将 ProxyPreserveHost 设置为关闭,看看是否可以。