简体   繁体   中英

What happens when I go to localhost in a browser without specifying a port?

I understand what happens when I specify a port. But what happens when I don't? It makes no sense to me since while doing development, my local grails server picks up requests from localhost without any port specification, despite that it's supposed to be on port 8080.

So what happens when you just go to localhost in a browser with no port? What controls where the request goes?

If you don't specify the protocol it assumes HTTP. This standard defines URI: https://tools.ietf.org/html/rfc3986

If you don't specify the port, it assumes port 80.

If no server is listening in port 80, the browser will receive a RST at TCP level when it tries to establish a TCP connection (below HTTP layer). You will see a message like "Connection Refused".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM