Regex 来自子域的apache proxypass
我想在apache2中从子域代理传递到像这样的其他端口 -> 是否仍要使用此子域而不是所有子域编写配置文件 不管怎样,比如http://.*.example.com->http://.*.example.com:6543 http://.*.example.com/first/second->http://.*.example.com:6543/first/second 这是我的配置文件Regex 来自子域的apache proxypass,regex,apache,mod-proxy,proxypass,Regex,Apache,Mod Proxy,Proxypass,我想在apache2中从子域代理传递到像这样的其他端口 -> 是否仍要使用此子域而不是所有子域编写配置文件 不管怎样,比如http://.*.example.com->http://.*.example.com:6543 http://.*.example.com/first/second->http://.*.example.com:6543/first/second 这是我的配置文件 ServerName example.com ProxyPassMatch^([^.]+)\.exampl
ServerName example.com
ProxyPassMatch^([^.]+)\.example\.com(.*)http://$1.example.com:6543/$2
ProxyPassReverse/http://example.com
你需要这个。它可以使用[P]
进行代理。按如下方式使用它(为了满足语法突出显示,VirtualHost标记被删除):
%1
是在条件中匹配的子域,$1
是由规则匹配的路径
您也可以在不使用重写条件的情况下使用
RewriteRule ^(.*) http://%{HTTP_HOST}:6543/$1 [P]
我使用了上面的额外步骤来增加信息量,例如,在您想要的活动中
ServerName example.com
RewriteEngine on
RewriteCond %{HTTP_HOST} ^([^.]+)\.example\.com$
RewriteRule ^(.*) http://%1.example.com:6543/$1 [P]
RewriteRule ^(.*) http://%{HTTP_HOST}:6543/$1 [P]