I'm tiring to create new docker container like this:
docker run -d -p5050:443 --name=free-proxy -v proxy-config:/data -e telegrammessenger/proxy:latest
this command successfully created a new container. now i want to restrict this container, to only work with host name not IP address. i try this command:
docker run -d -ptest.com:5050:443 --name=fourth-proxy -v proxy-config:/data -e telegrammessenger/proxy:latest
but i get this error:
docker: Invalid ip address: test.com.
i just want my container only work with host name (not IP address.)
NOTE: i want to access to my container from outside with just host name. if the clients use IP address they cant use the proxy:
tg://proxy?server=4.2.2.4&port=5050 (not acceptable)
tg://proxy?server=test.com&port=5050 (acceptable)
Docker publishes ports at the L4 layer, it is not looking at the L7 data that could contain the hostname. The only thing you have when listening on tcp/ip ports is the port number and the network interface (represented by the ip address).
To filter by hostname, you'll need to either place this logic in your application, or setup a proxy in front of your application to do the filtering. There are several reverse proxies that could do this, including traefik, nginx, and haproxy.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With