I have a service on port 3000 with Proxy/ReverseProxy on Apache at Port 80 on http://myserver/foo
.
I want to put another server on port 3456 and Proxy/ReverseProxy it from http://myserver/bar
on Apache as well.
What would be the best strategy?
My foo.conf
on httpd/conf.d
<VirtualHost *:80>
RewriteEngine on
RewriteRule ^/?$ /foo/ [R=permanent,L]
<Location "/foo">
ProxyPass http://localhost:3000
</Location>
ProxyPassReverse /foo http://localhost:3000
ProxyPreserveHost On
</VirtualHost>
You can basically just repeat what you already have for the /bar
URL-path as well. Except you'll need to move the existing ProxyPassReverse
directive inside the <Location>
section. (In your current config, you don't strictly need the <Location>
section.)
For example:
<VirtualHost *:80>
RewriteEngine on
RewriteRule ^/?$ /foo/ [R=permanent,L]
ProxyPreserveHost On
<Location "/foo">
ProxyPass http://localhost:3000
ProxyPassReverse http://localhost:3000
</Location>
<Location "/bar">
ProxyPass http://localhost:3456
ProxyPassReverse http://localhost:3456
</Location>
</VirtualHost>
Although this <VirtualHost>
container would seem incomplete since you have no ServerName
(ServerAlias
, ErrorLog
, etc.) directive(s). So I assume these are already defined in the main server config?