500 Error when using proxy_cookie_domain

Valentin V. Bartenev ne at vbart.ru
Fri May 18 20:22:25 UTC 2012


On Friday 18 May 2012 21:25:41 omar_h wrote:
> Hello, I'm using Nginx as a reverse proxy and I'm seeing 500 errors
> anytime the proxy_cookie_domain option feature is used.  I'm trying to
> change the domain in the "Set-Cookie" header.
> 
> The response header shows the replaced domain properly in the
> "Set-Cookie" header, however, it is a 500 Error response and does not
> output the page content.
> 
> Is there any way to find the cause of this error?  I tried using both
> strace and the debug log, but could not find any cause.
> 
> Here is a snippet of the debug log
>

The patch below should resolve this issue. Could you please test it?

Index: src/http/ngx_http_upstream.c
===================================================================
--- src/http/ngx_http_upstream.c        (revision 4642)
+++ src/http/ngx_http_upstream.c        (working copy)
@@ -3677,6 +3677,7 @@ static ngx_int_t
 ngx_http_upstream_rewrite_set_cookie(ngx_http_request_t *r, ngx_table_elt_t *h,
     ngx_uint_t offset)
 {
+    ngx_int_t         rc;
     ngx_table_elt_t  *ho;
 
     ho = ngx_list_push(&r->headers_out.headers);
@@ -3687,7 +3688,8 @@ ngx_http_upstream_rewrite_set_cookie(ngx_http_requ
     *ho = *h;
 
     if (r->upstream->rewrite_cookie) {
-        return r->upstream->rewrite_cookie(r, ho);
+        rc = r->upstream->rewrite_cookie(r, ho);
+        return (rc == NGX_DECLINED) ? NGX_OK : rc;
     }
 
     return NGX_OK;



More information about the nginx mailing list