Klaus Demo nginx / 6d92e76
Merge of r4651: proxy_cookie_* fix. Fixed returned value handling from the cookie rewrite handler. If the "proxy_cookie_domain" or "proxy_cookie_path" directive is used and there are no matches in Set-Cookie header then ngx_http_proxy_rewrite_cookie() returns NGX_DECLINED to indicate that the header was not rewritten. Returning this value further from the upstream headers copy handler resulted in 500 error response. See here for report: http://mailman.nginx.org/pipermail/nginx/2012-May/033858.html Maxim Dounin 9 years ago
1 changed file(s) with 15 addition(s) and 1 deletion(s). Raw diff Collapse all Expand all
36763676 ngx_http_upstream_rewrite_set_cookie(ngx_http_request_t *r, ngx_table_elt_t *h,
36773677 ngx_uint_t offset)
36783678 {
3679 ngx_int_t rc;
36793680 ngx_table_elt_t *ho;
36803681
36813682 ho = ngx_list_push(&r->headers_out.headers);
36863687 *ho = *h;
36873688
36883689 if (r->upstream->rewrite_cookie) {
3689 return r->upstream->rewrite_cookie(r, ho);
3690 rc = r->upstream->rewrite_cookie(r, ho);
3691
3692 if (rc == NGX_DECLINED) {
3693 return NGX_OK;
3694 }
3695
3696 #if (NGX_DEBUG)
3697 if (rc == NGX_OK) {
3698 ngx_log_debug1(NGX_LOG_DEBUG_HTTP, r->connection->log, 0,
3699 "rewritten cookie: \"%V\"", &ho->value);
3700 }
3701 #endif
3702
3703 return rc;
36903704 }
36913705
36923706 return NGX_OK;