I'm trying to setup proxy in apache like so:
<VirtualHost *:80>
ServerName test.public.domain
...
RewriteRule "^/dir/(.*)" "http://x-service.local/$1" [P,L]
...
there is also another vhost conf on the same server:
<VirtualHost *:80>
ServerName x-service.local
...
in /etc/hosts
on apache server I have following entry:
x-service.local 127.0.0.1
When I do curl test.public.domain/dir/xxx
from my workstation I got 5xx code.
When I do curl x-service.local/xxx
from server itself I got 200 code.
When I change
x-service.local 127.0.0.1
to
x-service.local 192.168.1.1
curl test.public.domain/dir/xxx
works fine. 192.168.1.1 is a IP of server's interface.
- apache listen on
0.0.0.0:80
- no firewall
Looks like proxying to domain resolved as loopback interface doesn't work for some reason. I don't understand why I'd like to know how to make it work as such a setup would simplify my configuration for multiple servers.