From 72df0f400a4f6144f9c69add91002a0ff02cfe41 Mon Sep 17 00:00:00 2001 From: Maxim Dounin Date: Wed, 12 Oct 2011 13:28:03 +0000 Subject: Clear old Location header (if any) while adding a new one. This prevents incorrect behaviour when another redirect is issued within error_page 302 handler. --- src/http/ngx_http_script.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/http/ngx_http_script.c') diff --git a/src/http/ngx_http_script.c b/src/http/ngx_http_script.c index a703f0837..6d81b4435 100644 --- a/src/http/ngx_http_script.c +++ b/src/http/ngx_http_script.c @@ -1106,6 +1106,8 @@ ngx_http_script_regex_end_code(ngx_http_script_engine_t *e) "rewritten redirect: \"%V\"", &e->buf); } + ngx_http_clear_location(r); + r->headers_out.location = ngx_list_push(&r->headers_out.headers); if (r->headers_out.location == NULL) { e->ip = ngx_http_script_exit; -- cgit