Saya mencoba mengkonfigurasi proxy terbalik dengan apache, tetapi saya mendapatkan No protocol handler was valid for the URL
kesalahan, yang saya tidak mengerti.
Ini adalah konfigurasi apache yang relevan:
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/
Permintaan mencapai apache sebagai:
POST /gonvaled/examples/jsonrpc/output/services/EchoService.py HTTP/1.1
Dan mereka harus diteruskan ke layanan internal saya, yang terletak di:
0.0.0.0:8000/services/EchoService.py
Ini adalah log:
==> /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"
apache-http-server
reverse-proxy
dangonfast
sumber
sumber
Bagi mereka yang datang mencari jawaban, kemungkinan lain adalah nama layanan URL untuk backend juga tidak ada. Dengan LogLevel Debug, dan mod_proxy dan mod_proxy_fcgi, saya melihat yang berikut:
[debug] proxy: fgci: found worker fgci://127.0.0.1:9000/var/www/html/.../index.php [debug] mod_proxy.c(1026): Running scheme fgci handler (attempt 0) [debug] mod_proxy_fcgi.c(800): [client ...] AH01076: url: fgci://127.0.0.1:9000/var/www/html/.../index.php proxyname: (null) proxyport: 0 [debug] mod_proxy_fcgi.c(805): [client ...] AH01077: declining URL fgci://127.0.0.1:9000/var/www/html/.../index.php [warn] proxy: No protocol handler was valid for the URL /.../index.php. If you are using a DSO version of mod_proxy, make sure the proxy submodules are included in the configuration using LoadModule.
Untungnya kode untuk mod_proxy_fastcgi (saya menggunakan backport untuk Apache 2.2 di RHEL6) tersedia di https://github.com/ceph/mod-proxy-fcgi/blob/master/mod_proxy_fcgi.c#L805 , yang ini sepotong kode:
Jika Anda memperhatikan log - saya hanya memperhatikan ketika melihat kode yang mengeluarkan pesan - Anda akan melihat bahwa apa yang seharusnya
fcgi://...
salah eja sebagaifgci://...
Jadi, ketika Anda melihatnya
declining URL
artinya:sumber