Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

API via Web: use 80 port or a custom one (like 8080)?

Tags:

java

http

We have a web service that won't be accessed by human users. I.e. only by:

  1. Javascript from a browser
  2. Mobile applications (iPhone & Android)
  3. Other servers

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?

like image 691
Eugene Retunsky Avatar asked Apr 19 '12 17:04

Eugene Retunsky


People also ask

Can I use HTTP port 80 instead of 8080?

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`.

What is the difference between port 80 (HTTP) and port 443?

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?

What is port 80 used for in web development?

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.

What is the default port for HTTP traffic?

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.


1 Answers

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.

like image 163
Perception Avatar answered Sep 23 '22 11:09

Perception