I know you can't put a port in /etc/hosts, so how can I achieve the equivalent of:
127.0.0.1 https://website.com:4433
For WordPress, I need CURL to go to 127.0.0.1 on port 4433. As it's wordpress and not a script I made, I can't change that.
I managed to find the iptables rule to fix my issue:
Add a line into your
/etc/hosts
:then configure your program (whatever it is) to listen on 4433 at 127.0.0.1.
And you're done.
Example:
now open
website.com:4433
and you should see a "hi".to fix the problem you mentioned in the comments you can use
socat
:with the above command,
socat
will listen on4433
and whenever a request came in in will forward it to thexx
, so change thexx
with the real port where your program is listening to.If you use the Chrome web browser, they have a URL aliasing app. It's called URL Alias. Just load it and define a web site. In the definition, you can add the full URL with port designation.