我有一个看起来像的工作配置
ProxyPass /roundcube protocol://127.0.0.1:8080/roundcube
ProxyPassReverse /roundcube protocol://127.0.0.1:8080/roundcube
当我去
http://www.example.com/roundcube
or
https://www.example.com/roundcube
正如预期的那样,两者或正确代理到 127.0.0.1:8080 上的服务器。
但是,我想更好地控制代理何时发生,所以我想使用 mod_rewrite 的 [P] 选项而不是上面显示的 ProxyPass 指令。我尝试了以下方法:
RewriteEngine On
RewriteRule ^/roundcube$ /roundcube/ [R]
RewriteRule ^/roundcube/(.*) protocol://127.0.0.1:8080/roundcube/$1 [P]
ProxyPassReverse /roundcube protocol://127.0.0.1:8080/roundcube
有了这个配置,当我去
http://www.example.com/roundcube
请求代理按预期正确。
但是当我去
https://www.example.com/roundcube
请求 404 的。
所以我的问题是,对于 http 和 https 请求,为什么 mod_rewrite 代理的工作方式与 ProxyPass 版本不同?根据我的理解,我上面的两个示例在功能上应该是等效的,但似乎并非如此。我错过了什么?我无法找到任何可以解释这一点的文档。谢谢!