[PATCH] Honor the redirect response overwritten in error_page for absolute urls

Maxim Dounin mdounin at mdounin.ru
Thu Jan 10 12:32:43 UTC 2013


On Thu, Jan 10, 2013 at 07:31:07PM +0800, lanshun zhou wrote:

> Absolute url in error_page is always treated by an internal redirect, even
> if the response
> code is specified with 301/302. This patch honors the response code
> specified and
> makes it possible to redirect with absolute url in error_page easily.

I don't like this change.  Current behaviour is well-defined and 
allows to do anything (with an additional step in some case).  On 
the other hand, introducing logic which takes new response code 
into account will complicate things.  The difference between these 
two lines will be counterintuitive:

    error_page 301 /foo.html;
    error_page 301 =302 /foo.html;

Additionally, it will break configs like this:

    error_page 301 =302 /foo.html;

    location = /foo.html {

(I.e. change the response code and return content from the 

Maxim Dounin

More information about the nginx-devel mailing list