Microos
Microos

Reputation: 1768

What's different between URI, request-URI and URL?

I'm learning Web tech and teacher cannot give me a satisfactory explanation. I'd like to give a few example, please help me to point out am I right.

Upvotes: 16

Views: 93201

Answers (4)

DEv0-37
DEv0-37

Reputation: 11

For someone looking for example of how an endpoint will results in URL and URI in tomcat like servers,

If this is your ENDPOINT: https://localhost:8443/admin/index.jsp?action=home

Request-URL will be : "https://localhost:8443/admin/index.jsp"
Request-URI will be : "/admin/index.jsp"

URL -> is the resource (index.jsp) locator to locate a page across pages in web.
URI -> is an identifier of the resource (index.jsp) within App domain.

Basically both is resolving the index.jsp in different contexts.

Upvotes: 1

Søren Løvborg
Søren Løvborg

Reputation: 8751

The term "Request-URI" is defined by the HTTP standard (RFC 2616, §5.1.2), and refers to the URL as it is given in the actual HTTP request.

In normal HTTP requests, the URL scheme and host have already been handled by the time the request is sent (and the URL fragment does not exist at the HTTP protocol level at all), meaning the Request-URI is a path-absolute-URL string, possibly followed by ? and a URL-query string.

That is to say, this part of the complete URL:

https://example.org/path/to/file?param=42#fragment
                   ^^^^^^^^^^^^^^^^^^^^^^

Note that it includes the leading /.

Exceptions to this include:

  • For e.g. the OPTIONS HTTP method, the Request-URI may simply be *.
  • When the HTTP server is acting as a proxy, the Request-URI may be a complete absolute-URL string (still excluding the fragment).
  • Other, more elaborate/non-standard things.

Upvotes: 16

ToTaTaRi
ToTaTaRi

Reputation: 329

I know it's an old topic, but I came across it on my current research, maybe others will have related issues:

You can find the term "Request_URI" in the apache server language, I don't know if that was ment... Here it would be similiar to "Path", i.e. used to lock the access via .htaccess to a specific URL somehow like this:

URL: www.example.de/lockthissite/

.htaccess code:

SetEnvIfNoCase Request_URI ^/lockthissite/$ SECURED=yes

AuthType Basic
AuthName "restricted access"
AuthUserFile /path/to/my/.htpasswd
Require valid-user
Satisfy any
Order allow,deny
Allow from all
Deny from env=SECURED

Upvotes: -3

unor
unor

Reputation: 96737

The URI standard is STD 66, which currently maps to RFC 3986.

URI vs. URL

Section 1.1.3 describes the difference between URIs and URLs (and URNs).

Components

Section 3 describes the components a URI can have.

For the URI http://www.example.org:56789/a/b/c.txt?t=win&s=chess#para5 these would be:

request-URI

The term "request-URI" is not defined or even used in STD 66 / RFC 3986.

Upvotes: 21

Related Questions