Welcome! Log In Create A New Profile

Advanced

Re: Beginner question:Nginx request_uri meaning ?

Maxim Dounin
January 11, 2017 12:30PM
Hello!

On Wed, Jan 11, 2017 at 05:18:26PM +0100, Bike dernikov1 wrote:

> Hi, i have "simple" question, need simple explanation. It's driving me
> nuts.
>
> In nginx configuration what is meaning of $request_uri in line?
>
> *********************************************************
> return 301 $scheme://example.com1$request_uri;
> ***********************************************************
> In documentation write: $request_uri is full request URI.
> I will try to describe my doubth.
>
> Simple request URL: http://www.example.com/index.html
>
> Full request URI is the same: http://example.com/index.html
>
> $request_uri=http://example.com/index.html.
>
> As i understand then line:
>
> return 301 $scheme://example1.com$request_uri;
>
> must return:
>
> http://example1.comhttp://example.com/index.html.
>
> But that cannot be correct.
>
> So what mean var $request_uri ? Is defined wrong in documentation. (or URI
> is not what i described ?) or it mean something different, or it mean
> something different in combination with return ??
> Thanks for help.

The term "request URI" as used in the nginx documentation in many
places, as well as in various variables, dates back to the
original and most common HTTP meaning - the URI form as used
identify a resource on a server.

Quoting https://tools.ietf.org/html/rfc1945#section-5.1.2:

The most common form of Request-URI is that used to identify a
resource on an origin server or gateway. In this case, only the
absolute path of the URI is transmitted (see Section 3.2.1,
abs_path). For example, a client wishing to retrieve the resource
above directly from the origin server would create a TCP connection
to port 80 of the host "www.w3.org" and send the line:

GET /pub/WWW/TheProject.html HTTP/1.0

followed by the remainder of the Full-Request. Note that the absolute
path cannot be empty; if none is present in the original URI, it must
be given as "/" (the server root).

At the HTTP/1.0 time this was the only allowed form in requests to
origin servers (absolute form was only allowed in requests to a
proxy).

With HTTP/1.1 absolute form can be also used in normal
requests, but it's not something actually used in practice, and
also not something various configurations and software can cope
with. So even if a request uses the absolute form of the request
URI, nginx provides $request_uri as if it was given in the
abs_path form.

--
Maxim Dounin
http://nginx.org/
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Beginner question:Nginx request_uri meaning ?

Bike dernikov1 January 11, 2017 11:20AM

Re: Beginner question:Nginx request_uri meaning ?

Maxim Dounin January 11, 2017 12:30PM

Re: Beginner question:Nginx request_uri meaning ?

Bike dernikov1 January 12, 2017 03:46AM

Re: Beginner question:Nginx request_uri meaning ?

Maxim Dounin January 12, 2017 08:42AM

Re: Beginner question:Nginx request_uri meaning ?

tokers January 23, 2017 04:15AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 164
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready