ProxyPass tutto il dominio su Tomcat, incluso root


8

Ho configurato il mio VirtualHost esempio.com per inoltrare tutte le richieste a un server Tomcat

ProxyPass / http://localhost:8088/app
ProxyPassReverse / http://localhost:8088/app

Funziona bene con URL come example.com/page , ma per example.com ed example.com/ ottengo questa risposta di reindirizzamento, che ovviamente non porta a nulla.

HTTP/1.1 302 Moved Temporarily
Date: Wed, 06 Jul 2011 21:13:37 GMT
Server: Apache-Coyote/1.1             <-- the redirect comes from tomcat
Location: http://example.com/app/     <-- nonsense
...

Cosa posso fare per risolverlo? Preferibilmente nella configurazione di Apache.

Sto usando Apache 2 e Tomcat 7

Risposte:


10

Non sono esattamente sicuro del perché, ma questa è la soluzione

ProxyPass / http://localhost:8088/app/
ProxyPassReverse / http://localhost:8088/app/

(Aggiunte barre alla fine)


8
Le barre devono sempre corrispondere. Dalla documentazione mod_proxy :If the first argument ends with a trailing /, the second argument should also end with a trailing / and vice versa. Otherwise the resulting requests to the backend may miss some needed slashes and do not deliver the expected results.
— Shane Madden,
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.