Looking for help for the next Apache's reverse-proxy problem.
- have an Apache 2.4 on the localhost:80 (a.a.a.a:80)
- have 3 different web applications
- one runs on localhost:8000 (a.a.a.a:8000)
- two others are in another machines - so x.x.x.x:8000 and y.y.y.y:8000
- have some static content (few html pages) on the basic apache:80 's
DocumentRoot
Requirements:
appX(on the x.x.x.x:8000) should be accessed by http://a.a.a.a/appX/appY(on the y.y.y.y:8000) as http://a.a.a.a/appY/- existing static pages (from the apache's
DocumentRoot) should be served as usually by apache defapp- everything other should be proxied to a.a.a.a:8000
It is easy configure the appX and appY like the next:
ProxyPass /appX/ http://x.x.x.x:8000/
ProxyPassReverse /appX/ http://x.x.x.x:8000/
ProxyPass /appY/ http://y.y.y.y:8000/
ProxyPassReverse /appY/ http://y.y.y.y:8000/
The above works OK. So when tried access http://localhost/appX/ got a response from the appX at the x.x.x.x:8000.
But have a problem with the default destinaton for everything other. When tried to add:
ProxyPass / http://127.0.0.1:8000/
ProxyPassReverse / http://127.0.0.1:8000/
It doesn't works as I hope...
With the above want tell to apache - everything other what is not /appX/ or /appY/ send to 0:8000.
And this is unfortunately doesn't works, the defapp what runs on 0:8000 got the requests for the appX and appY, and the requests for the static pages too.
Switching the order of definitions, so
#define first the "default destination"
ProxyPass / http://127.0.0.1:8000/
ProxyPassReverse / http://127.0.0.1:8000/
#and after the appX and appY
ProxyPass /appX/ http://x.x.x.x:8000/
ProxyPassReverse /appX/ http://x.x.x.x:8000/
ProxyPass /appY/ http://y.y.y.y:8000/
ProxyPassReverse /appY/ http://y.y.y.y:8000/
doesn't works either. Everything is proxied to localhost:8000.
So, the question is: is possible configure Apache as a reverse proxy to handling the above defined requiremens?