Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'd like to do much the same thing described at Redirect Domain Name to Localhost for web app development purposes, but with the twist that I'd like requests to to be routed to localhost:8080, say, so that I don't have to actually use my development machine's port 80.

I'd welcome answers that take the form of:

  • Small changes to configuration files like /etc/hosts, and/or
  • An easy-to-configure proxy server I could run

Note: Pow takes the approach of setting a firewall rule to forward all incoming traffic on port 80 to port 20559. That may be an acceptable solution, but ideally, I'd like to forward only a specific domain + port combination.

share|improve this question
Do you already have a webserver running on port 80? If so does it support url rewriting? – Paul Nov 25 '11 at 23:13
@Paul I may have different things running on port 80 at different times. So I'd prefer a solution that can run in front of the webserver. – Trevor Burnham Nov 25 '11 at 23:39

You may have to use an external device. I'd set up port forwarding on your firewall / router, on port 80, to point to your computer's port 8080, where fakedomain has an entry in your hosts file pointing to your external firewall / router.

share|improve this answer

The whole range belongs to your local machine. You don't have to use alone.

You can point your (fake) domain to in your hosts and setup your server to bind just to that IP as opposed to all IPs. In Windows and Linux, the most specific binding wins if there's a conflict, so your binding for overrides the one for *:80.

share|improve this answer
Interesting. I'd appreciate Mac-specific instructions for doing this. – Trevor Burnham Nov 26 '11 at 0:28
It's almost exactly the same story. You modify /etc/hosts and change the apache/whatever configuration file to make the relevant virtual host Listen to the 127.x.y.z IP. – Nov 26 '11 at 0:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .