Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 want to give a domain name to the IP address and port for an application in Windows 7. For example, test.com should map to 127.0.0.1:59873.

Is there anyway that we can do it by using a web server or DNS server?

share|improve this question
1  
You are trying to do something that doesn't make any sense. What's your actual problem? What are you trying to make happen? – David Schwartz Feb 25 '12 at 23:54
    
I am using one application which is running on 127.0.0.1:5986.I want use this address in different application but this application doesn't accept ":" in 127.0.0.1:5986.So I want to create an name with the ip and port. – sandeep.malladi Feb 26 '12 at 0:12
1  
Unfortunately there is no known/easy way to make an alias for an IP/port pair. The closest you can come is making an alias for an IP address with the HOSTS file. :-( – Synetech Feb 26 '12 at 0:18
2  
@Synetech Bad troll is bad. Reverse proxies do this all the time. – ta.speot.is Feb 26 '12 at 0:21
1  
@ta.speot.is, fine; drop the “known” from my comment and leave the “easy”. – Synetech Feb 26 '12 at 0:37

Most webservers can be run as reverse proxies, suitable for doing this. If you do everything right, you'll end up with something like the below (minus the "remote" part - since this will all be on one machine):

reverse proxy

  • Navigator is your machine
  • Reverse Proxy is nginx running on your machine (127.0.0.1:80)
  • Remote Server is the web site running on your machine (127.0.0.1:59873)

You can use a lightweight webserver like nginx (even runs on Windows), configure it to reverse proxy test.com to 127.0.0.1:59873 and then add the following entry to your HOSTS file:

127.0.0.1 test.com
share|improve this answer
2  
looks impressive. Out of interest, why is that called reverse proxy? a proxy is a middle man.. what is the reverse aspect? – barlop Feb 26 '12 at 1:59
2  
@barlop what we used to call just "proxy" or proxy server normally sits close to the client, or in the client infrastracture and it is just used by a set of clients to access multiple content. A reverse proxy works close to the server, any client that want to access that content will reach first the reverse proxy. – José F. Romaniello Mar 27 '12 at 17:21

I'm posting this for anybody that is looking to set up a reverse proxy using IIS 7 and above.

For example, in my case, I was trying to use Azure Storage Emulator which is 127.0.0.1:10000 and Remote module of ImageProcessor.Web which does not allow ":" in the whitelisted URLs. So I set a reverse proxy for dev.azureblob.com forwarding to 127.0.0.1:10000.

Nicked from here, done and tested: http://www.myconnectionserver.com/support/tutorials/v90/iisProxy/index.html

  1. Make sure the following packages have been installed on the IIS server:

    • Application Request Routing
    • URL Rewrite

  2. Select the website required from the sites list in IIS. This will display a list of options in the right-hand window.

    Double-click the URL Write option.

  3. Click the Add Rule link in the right-hand side menu.

  4. In the following window select the Reverse Proxy option and click the OK button.

  5. Before entering a server name of IP address make sure you check the Outbound Rules checkbox.

  6. Enter the server name or IP address where the HTTP requests will be forwarded.

    You will see that the from field in the Outbound rules section will mimic the server name/IP that has just been entered.

    All that is left to do is fill out the To section in Outbound rules. This is simple as the dropdown list provided will contain the original server name/IP. Simply select it and click the OK button to save the changes.

  7. Process complete.

    There should now be an inbound and outbound URL rewrite rule showing in the URL Rewrite window. With these rules in place the website of choice should now work as a reverse proxy.

share|improve this answer
    
One small niggle is that you didn't block quote the text quoted from the link. I've fixed that for you. For future reference please read How to reference material written by others – DavidPostill Mar 3 at 15:32

You can use a tool like socat (there are versions for MS-Windows but I haven't tried them) to create a reverse proxy / port forwarder. The command would be:

socat TCP-LISTEN:80,fork TCP:127.0.0.1:59873

This is likely to be easier than installing and configuring a full-blown web-server to do the same job.

So if you map test.com to 127.0.0.1 in %WINDIR%/System32/drivers/etc/hosts (or similar) you can then access http://test.com/ to reach your application listening on port 59873.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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