3

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.

a_z
  • 41
  • 3
  • "I got 5xx code" - 500? Or some other 5xx error? Check your error log for details. – MrWhite Sep 06 '17 at 13:49
  • 1
    502 also ```[Wed Sep 06 10:36:56.137196 2017] [proxy_http:error] [pid 16113] (20014)Internal error (specific information not available): [client 127.0.0.1:52264] AH01102: error reading status line from remote server x-service.local:80 [Wed Sep 06 10:36:56.137218 2017] [proxy:error] [pid 16113] [client 127.0.0.1:52264] AH00898: Error reading from remote server returned by /dir/xxx ``` – a_z Sep 06 '17 at 15:18

0 Answers0