Welcome! Log In Create A New Profile

Advanced

Support for relative URL in Location header

Jeroen Ooms
November 04, 2013 01:44PM
HTTP status codes such as 201, 301, 302, etc rely on the HTTP Location
header. The current standard of HTTP specifies that this URL must be
absolute. However, all popular browsers will accept a relative URL,
and it is correct according to the upcoming revision of HTTP/1.1. See
also [1].

I noticed that the version of nginx that I'm running (1.1.9, ubuntu
precise) does not properly interpret a relative URL. The docs on
"proxy_redirect" state that "The default replacement specified by the
default parameter uses the parameters of the location and proxy_pass
directives. " [2]. However it does not work when the Location path is
relative. For example if:

location /one/ {
proxy_pass http://upstream:port/two/;
proxy_redirect default;
}

Then a location header "http://upstream:port/two/foo.bar" gets
rewritten to "/one/foo.bar". However a location header "/two/foo.bar"
does not get rewritten to "/one/foo.bar", as it should if the relative
URL were supported.

Is this something that will, or already has been implemented in more
recent versions of nginx?



[1] http://en.wikipedia.org/wiki/HTTP_location#Relative_URL_example
[2] http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_redirect

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

Support for relative URL in Location header

Jeroen Ooms November 04, 2013 01:44PM

Re: Support for relative URL in Location header

Maxim Dounin November 04, 2013 08:10PM

Re: Support for relative URL in Location header

Jeroen Ooms November 05, 2013 11:32AM

Re: Support for relative URL in Location header

Maxim Dounin November 05, 2013 11:56AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 128
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