Can I map an IP address like 127.0.0.1
to a domain name and a port?
For example, I'd like to map 127.0.0.1
to api.example.com:8000
Thanks!
Can I map an IP address like 127.0.0.1
to a domain name and a port?
For example, I'd like to map 127.0.0.1
to api.example.com:8000
Thanks!
No, that's not possible. The port is not part of the hostname, so it has no meaning in the
hosts
-file.If you really need to do this, use reverse proxy.
For example, with nginx as reverse proxy