If you're proxying requests, your Web server will be making the connection, so the hostname needs to be something your Web server can connect to. It could be as simple as hardcoding in 127.0.0.1.
My suspicion is that when you're browsing internally, you're doing something like http://192.168.1.1, so when Apache rewrites the address to proxy, it connects to 192.168.1.1. When you're coming from the outside, you're visiting http://www.example.com. Apache rewrites the address, tries to connect to www.example.com, gets the IP address of the public side of the NAT, and can't connect to it. If that's the case, another solution is split horizon DNS, so that inside your network www.example.com resolves to 192.168.1.1, while outside it resolves to your external NAT address.
| [reply] |
Thanks for the tip. Changing the %{HTTP_HOST} part to the loopback address 127.0.0.1, seems to do the right thing in both cases.
| [reply] |