我的 httpd.conf 文件中有以下行
ProxyPass /something http://localhost:9080/servlet/StubEndpoint?stub=stub
系统响应
请求的资源 (/servlet/StubEndpoint%3Fstub=stub/) 不可用,即它替代了 ? %3F。我该如何解决这个问题?那个问号似乎被“%3F”取代了,我回来了 404
我的 httpd.conf 文件中有以下行
ProxyPass /something http://localhost:9080/servlet/StubEndpoint?stub=stub
系统响应
请求的资源 (/servlet/StubEndpoint%3Fstub=stub/) 不可用,即它替代了 ? %3F。我该如何解决这个问题?那个问号似乎被“%3F”取代了,我回来了 404
从ProxyPass的文档中:
url is a partial URL for the remote server and cannot include a query string.
在您的示例中,stub=stub
是查询字符串。%3F 替换是作为URL 编码的一部分完成的。
您可以代理到一个 URL,然后将其重定向到最终目的地(使用查询字符串),例如:
ProxyPass /something http://localhost:9080/proxy
RewriteEngine on
RewriteRule ^/proxy /StubEndpoint?stub=stub
这应该会导致任何以 /something 开头的 URL 返回到 StubEndpoint?stub=stub 的重定向。但是我自己还没有测试过。
我喜欢在位置分组。我的工作解决方案是:
<Location /something>
RewriteEngine On
RewriteRule ^ http://localhost:9080/servlet/StubEndpoint?stub=stub [P]
</Location>