Do web browsers always send a trailing slash after a domain name?

后端 未结 4 491
广开言路
广开言路 2020-11-29 08:36

Is there consistency and/or a standard on how browsers send a url to a host related to trailing slashes?

Meaning, if I type in http://example.com in the

4条回答
  •  广开言路
    2020-11-29 09:03

    The HTTP request sent from the browser to the server does not include the domain name, only the "path" portion (starting from the first slash after the domain name). Since the path cannot be empty, a / is sent in that case.

    A sample GET request for the root of a web site might be:

    GET / HTTP/1.0
    

    The / above cannot be omitted.

提交回复
热议问题