apache httpd.conf 中带有问号字符的问题

发布于 2024-10-01 03:37:07 字数 304 浏览 7 评论 0原文

中有以下行

我的 httpd.conf 文件ProxyPass /something http://localhost:9080/ servlet/StubEndpoint?stub=stub

系统响应

请求的资源 (/servlet/StubEndpoint%3Fstub=stub/) 不可用,即它替代?与%3F。我该如何解决这个问题?该问号似乎被“%3F”取代,我返回 404

I am have the following line in my httpd.conf file

ProxyPass /something http://localhost:9080/servlet/StubEndpoint?stub=stub

the system respondes with

The requested resource (/servlet/StubEndpoint%3Fstub=stub/) is not available, ie it substitutes ? with %3F. How can I resolve that problem? That question mark seems to be substituted by "%3F" and I am getting back 404

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

黑白记忆 2024-10-08 03:37:07

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 的重定向。不过我自己还没有测试过。

From the documentation for ProxyPass:

url is a partial URL for the remote server and cannot include a query string.

In your example, stub=stub is the query string. The %3F replacement is done as part of URL encoding.

You may be able to proxy to a URL which is then redirected to the ultimate destination (with a querystring), something like:

ProxyPass /something http://localhost:9080/proxy
RewriteEngine on
RewriteRule ^/proxy /StubEndpoint?stub=stub

This should cause any URLs starting with /something to return a redirect to StubEndpoint?stub=stub. However I have not tested this myself.

哽咽笑 2024-10-08 03:37:07

我喜欢按位置分组。我的工作解决方案是:

<Location /something>
    RewriteEngine On
    RewriteRule ^ http://localhost:9080/servlet/StubEndpoint?stub=stub [P]
</Location>

I like grouping in Location. My working solution is:

<Location /something>
    RewriteEngine On
    RewriteRule ^ http://localhost:9080/servlet/StubEndpoint?stub=stub [P]
</Location>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文