<div dir="ltr"><div>Hi,</div>Thanks for answer and detail explanation. <div>So to conclude and confirm that i undestand completly.</div><div>If client request </div><div><br></div><div><a href="http://www.example.com/index.html" rel="noreferrer" target="_blank" style="font-size:12.8px">http://www.example.com/index.<wbr>html</a><br></div><div><br></div><div><span style="color:rgb(80,0,80);font-size:12.8px">return 301 $scheme://</span><a href="http://example1.com/" rel="noreferrer" target="_blank" style="font-size:12.8px">example1.com</a><span style="color:rgb(80,0,80);font-size:12.8px">$</span><wbr style="color:rgb(80,0,80);font-size:12.8px"><span style="color:rgb(80,0,80);font-size:12.8px">request_uri;</span><br></div><div><font color="#500050"><span style="font-size:12.8px"><br></span></font></div><div><font color="#500050"><span style="font-size:12.8px">mean: return 301 <a href="http://example1.com/index.html">http://example1.com/index.html</a>.</span></font></div><div><font color="#500050"><span style="font-size:12.8px"><br></span></font></div><div><font color="#500050"><span style="font-size:12.8px">Thanks again for big help. I wold never found explanation myself.</span></font></div><div><font color="#500050"><span style="font-size:12.8px"><br></span></font></div><div><br></div><div><font color="#500050"><span style="font-size:12.8px"><br></span></font><div><br><div><br><div><br></div></div></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jan 11, 2017 at 6:28 PM, Maxim Dounin <span dir="ltr"><<a href="mailto:mdounin@mdounin.ru" target="_blank">mdounin@mdounin.ru</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello!<br>
<div><div class="h5"><br>
On Wed, Jan 11, 2017 at 05:18:26PM +0100, Bike dernikov1 wrote:<br>
<br>
> Hi, i have "simple" question, need simple explanation. It's driving me<br>
> nuts.<br>
><br>
> In nginx configuration what is meaning of $request_uri in line?<br>
><br>
> ******************************<wbr>***************************<br>
> return 301 $scheme://example.com1$<wbr>request_uri;<br>
> ******************************<wbr>*****************************<br>
> In documentation write: $request_uri is full request URI.<br>
> I will try to describe my doubth.<br>
><br>
> Simple request URL: <a href="http://www.example.com/index.html" rel="noreferrer" target="_blank">http://www.example.com/index.<wbr>html</a><br>
><br>
> Full request URI is the same: <a href="http://example.com/index.html" rel="noreferrer" target="_blank">http://example.com/index.html</a><br>
><br>
> $request_uri=<a href="http://example.com/index.html" rel="noreferrer" target="_blank">http://example.<wbr>com/index.html</a>.<br>
><br>
> As i understand then line:<br>
><br>
> return 301 $scheme://<a href="http://example1.com" rel="noreferrer" target="_blank">example1.com</a>$<wbr>request_uri;<br>
><br>
> must return:<br>
><br>
> http://example1.comhttp://<a href="http://example.com/index.html" rel="noreferrer" target="_blank">exam<wbr>ple.com/index.html</a>.<br>
><br>
> But that cannot be correct.<br>
><br>
> So what mean var $request_uri ? Is defined wrong in documentation. (or URI<br>
> is not what i described ?) or it mean something different, or it mean<br>
> something different in combination with return ??<br>
> Thanks for help.<br>
<br>
</div></div>The term "request URI" as used in the nginx documentation in many<br>
places, as well as in various variables, dates back to the<br>
original and most common HTTP meaning - the URI form as used<br>
identify a resource on a server.<br>
<br>
Quoting <a href="https://tools.ietf.org/html/rfc1945#section-5.1.2" rel="noreferrer" target="_blank">https://tools.ietf.org/html/<wbr>rfc1945#section-5.1.2</a>:<br>
<br>
The most common form of Request-URI is that used to identify a<br>
resource on an origin server or gateway. In this case, only the<br>
absolute path of the URI is transmitted (see Section 3.2.1,<br>
abs_path). For example, a client wishing to retrieve the resource<br>
above directly from the origin server would create a TCP connection<br>
to port 80 of the host "<a href="http://www.w3.org" rel="noreferrer" target="_blank">www.w3.org</a>" and send the line:<br>
<br>
GET /pub/WWW/TheProject.html HTTP/1.0<br>
<br>
followed by the remainder of the Full-Request. Note that the absolute<br>
path cannot be empty; if none is present in the original URI, it must<br>
be given as "/" (the server root).<br>
<br>
At the HTTP/1.0 time this was the only allowed form in requests to<br>
origin servers (absolute form was only allowed in requests to a<br>
proxy).<br>
<br>
With HTTP/1.1 absolute form can be also used in normal<br>
requests, but it's not something actually used in practice, and<br>
also not something various configurations and software can cope<br>
with. So even if a request uses the absolute form of the request<br>
URI, nginx provides $request_uri as if it was given in the<br>
abs_path form.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Maxim Dounin<br>
<a href="http://nginx.org/" rel="noreferrer" target="_blank">http://nginx.org/</a><br>
______________________________<wbr>_________________<br>
nginx mailing list<br>
<a href="mailto:nginx@nginx.org">nginx@nginx.org</a><br>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx" rel="noreferrer" target="_blank">http://mailman.nginx.org/<wbr>mailman/listinfo/nginx</a><br>
</font></span></blockquote></div><br></div>