我正在尝试在代理发生之前重新编写URL的一部分( https://myfirstdomain.com/lool/https:/alf.mydomain.com/service/wopi/files/uuid?query_params ),我有这个我的默认SSL vhost中的相关部分:
<IfModule mod_rewrite.c> RewriteEngine On LogLevel debug rewrite:trace3 RewriteRule ^lool/https:/alf.mydomain.com\/(.*) lool/https://alf.mydomain.com/$1 [QSA,NE] </IfModule> ProxyPass / https://localhost:2323/ ProxyPassReverse / https://localhost:2323/
我在重写日志中看到这个:
applying pattern '^lool/https:/alf.mydomain.com' to uri '/lool/https:/alf.mydomain.com/service/wopi/files/uuid
但在收到这个服务,我看到的URL没有被重写。 对于我在做什么错误的任何线索将感激不尽。 我本质上是试图添加额外/已被我没有访问的基础设施中的代理服务器删除。
编辑:在后端WOPI服务的日志中,它看到请求URL未修改:
Request from 127.0.0.1:42035: GET /lool/https:/alf.mydomain.com/service/wopi/files/uuid
RewriteRule ^lool/https:/alf.mydomain.com\/(.*) lool/https://alf.mydomain.com/$1 [QSA,NE]
在虚拟主机上下文中使用时, RewriteRule 模式会匹配完整的URLpath,包括斜杠前缀(仅在目录上下文中删除)。
尝试如下所示:
RewriteRule ^/lool/https:/(alf\.mydomain\.com/.*) /lool/https://$1 [PT,NE]
在虚拟主机上下文中使用replace时,还需要斜杠前缀,以便指定文档根相对URLpath。
我刚刚扩展捕获的模式,包括主机名以保存替代重复。
文字点应该在RewriteRule 模式中转义。 而斜线( / )不需要被转义。
QSA标志在这里是多余的,因为你没有指定replace的查询string。
您可能需要也可能不需要PT ( passthrough )标志,以便通过mod_proxy获取该标志。
你也应该删除<IfModule mod_rewrite.c>包装 – 除非这是为了没有mod_rewrite工作? 否则,当mod_rewrite不可用时,你只会掩盖一个错误。