Seluruh domain ProxyPass ke Tomcat, termasuk root


8

Saya telah mengkonfigurasi VirtualHost example.com saya untuk mem -proxy semua permintaan ke server Tomcat

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

Ini berfungsi dengan baik untuk URL seperti example.com/page , tetapi untuk example.com dan example.com/ Saya mendapatkan respons pengalihan ini, yang jelas tidak menghasilkan apa-apa.

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

Apa yang bisa saya lakukan untuk memperbaikinya? Lebih disukai di konfigurasi Apache.

Saya menggunakan Apache 2 dan Tomcat 7

Jawaban:


10

Saya tidak begitu yakin mengapa, tetapi ini adalah perbaikannya

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

(Menambahkan garis miring sampai akhir)


8
Garis miring harus selalu cocok. Dari dokumentasi 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
Dengan menggunakan situs kami, Anda mengakui telah membaca dan memahami Kebijakan Cookie dan Kebijakan Privasi kami.
Licensed under cc by-sa 3.0 with attribution required.