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?
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):
127.0.0.1:80
)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
HOSTS
file as 127.0.0.1:59873 test.com
. Why need reverse proxy ?
May 16, 2021 at 16:52
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
Make sure the following packages have been installed on the IIS server:
• Application Request Routing
• URL RewriteSelect 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.
Click the Add Rule link in the right-hand side menu.
In the following window select the Reverse Proxy option and click the OK button.
Before entering a server name of IP address make sure you check the Outbound Rules checkbox.
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.
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.
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.
HOSTS
file.:-(