Is there a default port that is requested by web browsers?

2

If I request http://localhost do browsers try a specific port?

Perhaps people set the default port server side? Or must ports be specified (eg. http://localhost:1234)?

I'm trying to make it as simple as I can for a client to connect to a locally hosted "remote controller" website.

Seph Reed

Posted 2017-07-31T21:25:19.353

Reputation: 225

1http by default is port 80 while https defaults to 443. If you are hosting on a different port the client must specify which port. – Zina – 2017-07-31T21:27:55.007

strange. I though port numbers were 4 digits long. If setting up a port, would it be 0080. My current program crashes if given a less than four digit number... but perhaps that's an issue elsewhere. – Seph Reed – 2017-07-31T21:32:30.880

got it, sudo is required for ports < 1024 – Seph Reed – 2017-07-31T21:35:51.947

1

setting up the port where? and BTW the port numbers are from 0 to 65535 see here for list of common port usage

– Zina – 2017-07-31T21:36:22.247

Answers

6

If I request http://localhost do browsers try a specific port?

There are three well known ports commonly used by web servers:

You can, of course configure your local web server to use whatever ports you like.


Further Reading

DavidPostill

Posted 2017-07-31T21:25:19.353

Reputation: 118 938

Thank you. I've also just found that certain permissions (sudo) are required for ports < 1024. – Seph Reed – 2017-07-31T21:36:52.770

@SephReed On Unix systems, yes. – DavidPostill – 2017-07-31T21:37:51.537

I wasn't until I tried port 80 as per directed by this answer. It's not really in total relation to this question, but it still seems useful enough to share. – Seph Reed – 2017-07-31T21:39:09.260

This link, posted above, might be a nice thing to add to the answer, just to wrap everything up: https://www.iana.org/assignments/service-names-port-numbers/service-names-port-numbers.xhtml

– Seph Reed – 2017-07-31T21:39:46.893

2

  • Default HTTP Port: 80
  • Default HTTPS Port: 443

Following is some of the recommended localhost ports for local developments.

  • Recommended Express.js(or LoopBack ) Dev Port: 3000, 8000, 8080 (by npm start)
  • Default Angular Webpack Dev Port: 4200 (by ng serve)
  • Default Ionic Webpack Dev Port: 8100, 8200 (by ionic serve or ionic lab)

...

List of Well-Known Ports Port numbers range from 0 to 65535, but only port numbers 0 to 1023 are reserved for privileged services and designated as well-known ports. The following list of well-known port numbers specifies the port used by the server process as its contact port.

Well-known ports range from 0 through 1023. Registered ports are 1024 to 49151. Dynamic ports (also called private ports) are 49152 to 65535.

https://www.webopedia.com/quick_ref/portnumbers.asp

Wencheng Li

Posted 2017-07-31T21:25:19.353

Reputation: 123

The default port in Laravel is also 80. (with php artisan serve) – AlmostPitt – 2019-03-28T10:43:47.477