After quite some time searching the Internet, I'm still struggling to configure my Apache Proxy virtual-host.
My setup is quite simple:
- server hosts several NodeJS-express apps
- one hand-made REST API (listening on port 8080)
- one adminMongo (listening on port 8081)
- Apache listens on port 80 and is accessible at 10.8.0.1
Here's the Apache config file that's been close to working:
<VirtualHost *:80> <Location /custom> RewriteEngine on RewriteRule ^/custom/(.*) /$1 ProxyPass http://localhost:8080/ ProxyPassReverse http://localhost:8080/ </Location> <Location /mongo> RewriteEngine on RewriteRule ^/mongo/(.*) /$1 ProxyPass http://localhost:8081/ ProxyPassReverse http://localhost:8081/ </Location> </Virtualhost>
This Vhost was inspired by this post: Apache: proxy based on URL suffixes.
The main problem is that when I try to GET
http://10.8.0.01/mongo/ I'm redirected to
http://10.8.0.1/app/login/ (the express-app is doing this) which gives me a 404 error since my Apache has nothing to serve at
How can I match all of the URL beginning with
/mongo/ to serve my app listening on
Any suggestion appreciated.