Proxy inverso Apache: nessun gestore di protocollo


20

Sto cercando di configurare un proxy inverso con apache, ma ricevo un No protocol handler was valid for the URLerrore, che non capisco.

Questa è la configurazione rilevante di 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/

Le richieste raggiungono apache come:

POST /gonvaled/examples/jsonrpc/output/services/EchoService.py HTTP/1.1

E dovrebbero essere inoltrati al mio servizio interno, situato in:

0.0.0.0:8000/services/EchoService.py

Questi sono i registri:

==> /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"

Risposte:


26

Ho trovato il problema. Il proxy_httpmodulo deve essere attivato anche in Apache (avevo solo proxy_htmle proxy)


23

Per me, su apache httpd 2.4, questo è successo perché mi mancava la barra finale:

Non ha funzionato:

    <Proxy balancer://mycluster>
        BalancerMember http://192.168.111.7
        BalancerMember http://192.168.111.80
    </Proxy>
    ProxyPass / balancer://mycluster
    ProxyPassReverse / balancer://mycluster

Lavorato!

    <Proxy balancer://mycluster>
        BalancerMember http://192.168.111.7
        BalancerMember http://192.168.111.80
    </Proxy>
    ProxyPass / balancer://mycluster/
    ProxyPassReverse / balancer://mycluster/

(aggiunto /alla fine)


Per me, apache 2.2.15, <kbd> / </kbd> alla fine funziona. GRAZIE!

mi ha aiutato su Apache / 2.4.10 (Debian). Questo deve essere documentato! Il messaggio di errore è estremamente ottuso
— DeveloperChris l'

2

Per coloro che cercano risposte, un'altra possibilità è che manchi anche il nome del servizio URL per il back-end. Con LogLevel Debug e mod_proxy e mod_proxy_fcgi, ho riscontrato quanto segue:

[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.

Per fortuna il codice per mod_proxy_fastcgi (sto usando un backport per Apache 2.2 su RHEL6) è disponibile su https://github.com/ceph/mod-proxy-fcgi/blob/master/mod_proxy_fcgi.c#L805 , che è questo pezzo di codice:

if (strncasecmp(url, "fcgi:", 5) != 0) {
    ap_log_rerror(APLOG_MARK, APLOG_DEBUG, 0, r, APLOGNO(01077) "declining URL %s", url);
    return DECLINED;
}

Se osservi attentamente i registri - l'ho notato solo guardando il codice che emette il messaggio - vedrai che ciò che dovrebbe essere fcgi://...è errato comefgci://...

Quindi quando vedi declining URLsignifica:

  • Non hai un gestore caricato che accetta il servizio (es. Fcgi :) o
  • hai errato il nome del servizio.

1
Ho votato a causa della parte "Quando vedi questo errore significa ..." di questa risposta. Sento che ciò dovrebbe condurre la maggior parte dei ricercatori nella giusta direzione.
— tre
Utilizzando il nostro sito, riconosci di aver letto e compreso le nostre Informativa sui cookie e Informativa sulla privacy.
Licensed under cc by-sa 3.0 with attribution required.