Naatan
Naatan

Reputation: 3444

Forward http traffic to web server running on virtual internal network

I'm running VirtualBox on OSX host with Debian guest. I use Debian to run my development LAMP environment and I would like all traffic on my host port 80 to be automatically forwarded to the Debian guest.

Currently my debian server is set up with 2 network adapters, one Host-Only and one NAT (the latter simply to give it an internet connection, it's not meant for server duty).

On my OSX host I've configured mod_proxy like so:

ProxyPass / http://debian/

(debian being the hostname of the debian guest). This works for me as my host shares an internal network with "debian", however if I quickly want to show something to a collegue and send them my url (192.168, etc) then they won't be so lucky.

How can I set up my configuration in such a way that my OSX apache server basically acts as a full on proxy solution for my debian server?

Thanks

Upvotes: 1

Views: 680

Answers (1)

Marc Bollinger
Marc Bollinger

Reputation: 3119

If I'm reading your question correctly, it sounds as though you understand ProxyPass to work similar to an HTTP 301/302 status, which is incorrect. A 302 HTTP status will say to the requesting client, "Hey, get this from some other address yourself." In this case, debian would have to be visible to your colleague.

However, ProxyPass (and reverse proxies in general) make the connection for you; the client doesn't need to (and very often doesn't) have direct access to the upstream server, in this case debian. Long story short, unless I'm reading this wrong, you should be good already, as long as Apache on your host machine (your physical box) is listening on an IP address they can see.

Upvotes: 1

Related Questions