Keep Server Online
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
or
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
Thank You! Steffen
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
| |
|
Topic: Handling 30X redirection from a backend server behind a prox |
|
Author |
|
Thierry
Joined: 19 Jan 2018 Posts: 2
|
Posted: Fri 19 Jan '18 12:18 Post subject: Handling 30X redirection from a backend server behind a prox |
|
|
I search for this probably common problem without founding any "good" solution.
Configuration:
https://frontend/myapp Proxypass to http://backend/
Apache/2.4.18 (Ubuntu 16.04 LTS, in containers) for both servers.
Backend serve files as a standard Web server.
Frontend server configuration:
ProxyRequests Off
ProxyPreserveHost On
ProxyPass /myapp/ http://backend/
ProxyPassReverse /myapp/ http://backend/
Problematic:
https://frontend/myapp/foo (Directory) is redirected (HTTP 301 / Location) by backend to http://frontend/foo/ (mod_dir feature)
This redirection is wrong because it use HTTP instead of HTTPS and application prefix (myapp) is omitted -> User have a 404 error.
A solution is to redirect: https://frontend/myapp to http://backend/myapp and handle http from frondent but make a dependance between server and opening 80 port.
What is the best practice to handle this use case ?
Add some Proxy options (ProxyAddHeaders, ProxyVia) ? Add RewriteRules on backendserver ? |
|
Back to top |
|
Thierry
Joined: 19 Jan 2018 Posts: 2
|
Posted: Mon 22 Jan '18 15:26 Post subject: [SOLVED] |
|
|
Problem solved: bad configuration of ProxyPreserveHost from a previous configuration.
It must be left as Off. |
|
Back to top |
|
|
|
|
|
|