[SOLVED] Virtualbox +NAT Apache ProxyPass
Posted: 17. Aug 2017, 16:27
Please tell me what I'm doing wrong. I have a configuration where apache listens on an external interface, hosts a domain, and acts as a proxy for a couple of internal servers. For the most part, this works perfectly. When a specific url matches the proxypass directive, apache forwards to the internal site. However, I am trying to use NAT to forward to another virtual server, but it keeps forwarding to the host, but only from the outside. For example, This is the configuration of the proxy:
The host listens on port 12000 under the name example.com. ProxyPass forwards the root of the domain to the computer, hostmachine
The proxy forwards /billing to port 2080 on the hostmachine, which is forwarded, using vbox NAT, from port 2080, to port 80, under the name example.com/billing
I am using NAT to forward port 2080 on the host, to port 80 of the virtual server.
Here is the issue, when I direct an internal (even the proxyserver) browser to hostmachine:2080, I get the expected html file from the virtual server1. When I try to access it from the outside, routing through the proxy I get the html file from the hostmachine
From an internal computer:
From the outside, this is what should happen
What is happening
Code: Select all
<VirtualHost *:80>
ServerName example.comCode: Select all
ProxyPass / http://hostmachine:12000/Code: Select all
ProxyPass /billing http://hostmachine:2080/billing/Code: Select all
vboxmanage showvminfo server1
...
NIC 1 Rule(0): name = http, protocol = tcp, host ip = , host port = 2080, guest ip = , guest port = 80From an internal computer:
Code: Select all
telnet hostmachine 2080
Trying 10.28.45.100...
Connected to hostmachine.
Escape character is '^]'.
GET /billing/index.html
test billing server1
Connection closed by foreign host.
From an external browser:Code: Select all
http://example.com/billing
test billing hostmachineCode: Select all
example.com:80/billing -> ProxyPass -> hostmachine:2080 -> 2080:NAT:80 -> server1:80/billingCode: Select all
example.com:80/billing -> ProxyPass -> hostmachine:80