我正在尝试实现一个条件代理指令,因此当某个查询字符串被调用到虚拟主机时,它会将其代理到其他地方并添加头。
但是,if指令中不允许使用ProxyPass。
我试着这样做:
VirtualHost <*:443>
ServerName "${APACHE_HOSTNAME}"
<If "%{QUERY_STRING} =~ /some_string/">
RequestHeader set "some_string" "some_string"
Header set "some_string" "some_string"
ProxyPass / https://<domain>/
ProxyPassReverse / https://<domain>/
</If>
</VirtualHost>有没有其他办法来解决这个问题?一些Virtualhost逻辑或使用重写?
谢谢!
发布于 2018-06-15 21:40:13
好的,这对我很有效:
<Location "/path_uri">
RewriteEngine on
RewriteCond %{QUERY_STRING} ^<query_string> [NC]
RequestHeader set "header" "header"
RewriteRule ^/(.*) https://URL/ [QSA,P,L]
ProxyPassReverse https://URL/
</Location>https://stackoverflow.com/questions/50874367
复制相似问题