小编bet*_*eta的帖子

使用 URL 编码 URL - apache mod-proxy (ProxyPass)

我有一个 ProxyPass 配置为达到以下目的:在我的服务器上,我启动了一个服务,该服务提供一个 Rest-API 监听端口 7777。从客户端,我希望能够像这样调用这个 API: http://example.org/servicename/PARAMETER

对此 API 的完整调用应如下所示: HTTP PUT @ http://example.org/servicename/PARAMETER(其中PARAMETER是某个字符串)。在内部,这应该转换为以下网址:http://server.ip:7777/servicename/PARAMETER

只要 PARAMETER 不是这样的(!),一切都会按预期工作:(http://parameter.org实际上我需要对其进行 URL 编码:)http%3A%2F%2Fparameter.org。总而言之,电话是http://example.org/servicename/http%3A%2F%2Fparameter.org

http://在参数混淆阿帕奇导致在回复呼叫以下错误信息:

!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /servicename/http://parameter.org was not found on this server.</p>
<hr>
<address>Apache/2.2.22 (Debian) Server at example.org Port 80</address>
</body></html>
Run Code Online (Sandbox Code Playgroud)

http%3A%2F%2Fparameter.org例如,如果我替换为test,则一切正常。http://参数中的不知何故混淆了apache。有没有办法让 apache 忽略它?

我目前对这个虚拟主机的配置如下所示:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        DocumentRoot /var/www/example
        ServerName …
Run Code Online (Sandbox Code Playgroud)

proxy virtualhost proxypass apache-2.2

3
推荐指数
1
解决办法
1万
查看次数

标签 统计

apache-2.2 ×1

proxy ×1

proxypass ×1

virtualhost ×1