Apache ProxyPass 如何不代理相对/子网址



当前配置取自 apache 配置文件:

ProxyPass                  /support      https://fe-help-help.staging/ retry=1 acquire=3000 timeout=600 Keepalive=On disablereuse=On smax=0 ttl=7
ProxyPassReverse           /support      https://fe-help-help.staging/
问题是子网址,例如"/support/test"不应该

被代理,但现在如果你尝试打开"/support/test",它最终会在"https://fe-help-help.staging/"中处理

我们可以排除除"/support"之外的所有其他路线变体吗?

尝试使用 ProxyPassMatch 指令。来自文档:此指令等效于 ProxyPass,但使用正则表达式而不是简单的前缀匹配。提供的正则表达式与 URL 匹配,如果匹配,服务器会将任何括号中的匹配项替换为给定字符串并将其用作新 URL。

例如:

ProxyPassMatch          ^/support$      https://fe-help-help.staging/ retry=1 acquire=3000 timeout=600 Keepalive=On disablereuse=On smax=0 ttl=7
ProxyPassReverse        /support        https://fe-help-help.staging/

最新更新