We have a web service that won't be accessed by human users. I.e. only by:
The question: is it OK to use some custom port for this (like 8080) or we should use only 80 port (so the URL won't contain the port number).
What are the pros and cons? Are there any reasons why the option with custom ports is unacceptable?
Switch to port 80 (instead of 8080) As this is a Docker container running a web application, it would make sense to expose the http port (80) instead of port 8080. A user can always specify the 'external' port to his liking using e.g. `-p 8080:80`.
All web traffic, either encrypted or unencrypted, is handled via Port. Generally, port 80 is used for HTTP, and port 443 is used for HTTPS protocol. This article will discuss about the difference between Port 80 (HTTP) and Port 443 (HTTPS) and the steps to enable them on different operating systems. What is a Port?
Also when a web developer deploys any web application, they primarily bind the app to the port 80. Or in other words web servers open port 80 to listen to all the connection requests coming from the web browser.
Note: Port 80 is the default for unencrypted HTTP traffic. Port 8080 is the port that is generally used by webservers to make TCP connections if default port 80 is busy. Generally, Port 8080 is chosen by the web server as the best alternative to 80 because it has two 80's and is above the restricted well-known port.
If some of your clients are behind a firewall they may have policies that restrict access to 'non-standard ports', including port 8080. Apart from that I do not see any cons to running your web service endpoints on port 8080. A pro is that if you want to run a regular web server on the same machine you can assign it port 80 with no conflicts.
Moving the service to another port doesn't increase your security risk any more than having it on the original port. Running on port 8080 shouldn't affect any mobile devices, as long as their ISP doesn't block the port.
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