Apache 反向代理:无协议处理程序

blu*_*ast 22 apache-http-server reverse-proxy

我正在尝试使用 apache 配置反向代理,但出现No protocol handler was valid for the URL错误,我不明白。

这是apache的相关配置:

ProxyRequests Off
ProxyPreserveHost On

<Proxy *>
       Order deny,allow
       Allow from all
</Proxy>

ProxyPass        /gonvaled/examples/jsonrpc/output/services/ http://localhost:8000/services/
ProxyPassReverse /gonvaled/examples/jsonrpc/output/services/ http://localhost:8000/services/
Run Code Online (Sandbox Code Playgroud)

请求到达 apache 为:

POST /gonvaled/examples/jsonrpc/output/services/EchoService.py HTTP/1.1
Run Code Online (Sandbox Code Playgroud)

他们应该转发到我的内部服务,位于:

0.0.0.0:8000/services/EchoService.py
Run Code Online (Sandbox Code Playgroud)

这些是日志:

==> /var/log/apache2/error.log <==
[Wed Jun 20 02:05:20 2012] [debug] proxy_util.c(1506): [client 127.0.0.1] proxy: http: found worker http://localhost:8000/services/ for http://localhost:8000/services/EchoService.py, referer: http://localhost/gonvaled/examples/jsonrpc/output/JSONRPCExample.safari.cache.html
[Wed Jun 20 02:05:20 2012] [debug] mod_proxy.c(998): Running scheme http handler (attempt 0)
[Wed Jun 20 02:05:20 2012] [warn] proxy: No protocol handler was valid for the URL /gonvaled/examples/jsonrpc/output/services/EchoService.py. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.
[Wed Jun 20 02:05:20 2012] [debug] mod_deflate.c(615): [client 127.0.0.1] Zlib: Compressed 614 to 373 : URL /gonvaled/examples/jsonrpc/output/services/EchoService.py, referer: http://localhost/gonvaled/examples/jsonrpc/output/JSONRPCExample.safari.cache.html

==> /var/log/apache2/access.log <==
127.0.0.1 - - [20/Jun/2012:02:05:20 +0200] "POST /gonvaled/examples/jsonrpc/output/services/EchoService.py HTTP/1.1" 500 598 "http://localhost/gonvaled/examples/jsonrpc/output/JSONRPCExample.safari.cache.html" "Mozilla/5.0 (X11; Linux i686) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.162 Safari/535.19"
Run Code Online (Sandbox Code Playgroud)

blu*_*ast 29

我发现了问题。该proxy_http模块也需要在 Apache 中激活(我只有proxy_htmlproxy


Nic*_*zza 23

对我来说,在 apache 上httpd 2.4,发生这种情况是因为我缺少尾部斜杠:

不工作:

    <Proxy balancer://mycluster>
        BalancerMember http://192.168.111.7
        BalancerMember http://192.168.111.80
    </Proxy>
    ProxyPass / balancer://mycluster
    ProxyPassReverse / balancer://mycluster
Run Code Online (Sandbox Code Playgroud)

工作了!

    <Proxy balancer://mycluster>
        BalancerMember http://192.168.111.7
        BalancerMember http://192.168.111.80
    </Proxy>
    ProxyPass / balancer://mycluster/
    ProxyPassReverse / balancer://mycluster/
Run Code Online (Sandbox Code Playgroud)

/在最后添加)