0

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:

<VirtualHost *:80>
   ServerName example.com

The host listens on port 12000 under the name example.com. ProxyPass forwards the root of the domain to the computer, hostmachine

ProxyPass / http://hostmachine:12000/

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

ProxyPass /billing http://hostmachine:2080/billing/

I am using NAT to forward port 2080 on the host, to port 80 of the virtual server.

vboxmanage showvminfo server1
...
NIC 1 Rule(0):   name = http, protocol = tcp, host ip = , host port = 2080, guest ip = , guest port = 80

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:

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:

http://example.com/billing
test billing hostmachine

From the outside, this is what should happen

example.com:80/billing -> ProxyPass -> hostmachine:2080 -> 2080:NAT:80 -> server1:80/billing

What is happening

example.com:80/billing -> ProxyPass -> hostmachine:80
0

Figured out the problem was with the proxy server. I forgot that Apache processes things in the order they appear, so I needed to place /billing in front of the /. For example, in the conf file for the domain,

ProxyPass /billing http://hoststmachine:2080/billing/

THEN

ProxyPass / http://hostmachine:12000/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.