bug with X-Accel-Expires 0 ?

Jérôme Loyet jerome at loyet.net
Fri Feb 19 12:15:09 MSK 2010


Hi igor,

I've made a patch for this bug. What do you think ?

++ jerome

Le 18 février 2010 11:48, Jérôme Loyet <jerome at loyet.net> a écrit :
> Hi,
>
> I have a strange behaviour, I think it's a bug.
>
> I have set nginx as a frontend to apache using proxy_pass. I also set
> up proxy_cache to cache everyhting from the proxy:
>
> log_format my_combined '$remote_addr - $remote_user [$time_local]
> "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"
> $request_time $upstream_cache_status';
> server {
>  ...
>  access_log /var/log/nginx/access my_combined;
>  proxy_cache cache1;
>
>  location / {
>    proxy_cache_valid any 5m;
>    proxy_pass http://backend.www;
>  }
> }
>
> To exclude some pages from being cached, I'm adding the
> "X-Accel-Expires: 0" in the response from the backend.It works as
> those pages are marked as MISS in the access log (MISS and HIT when
> X-Accel-Expires is not set).
>
> But, when the page is not cached (with X-Accel-Expires) some headers
> are hidden as if the page was cached.
>
>
> Here is some example:
>
> The backend set these headers:
>
> Set-Cookie: PHPSESSID=bd01a429e06336b883d36d6633a04917; path=/
> Content-Length: 11
>
> The client receives:
> Content-Length: 11
>
> As the page is cached, the Set-Cookie header is removed.
>
> Then if the backend add the X-Accel-Expires header:
>
> Set-Cookie: PHPSESSID=bd01a429e06336b883d36d6633a04917; path=/
> Content-Length: 11
> X-Accel-Expires: 0
>
> The clients receives:
> Content-Length: 11
>
>
> The page is not cached (thanks to X-Accel-Expires: 0) but the
> Set-Cookie headers has been removed without any reasons.
>
> This bug exists because the list of headers to remove are set when the
> conf is loaded (ngx_http_proxy_merge_loc_conf in
> http/modules/ngx_http_proxy_module.c at line 2256) and it should be
> done dynamicaly for each requests.
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nginx-0.8.33-bug.patch
Type: application/octet-stream
Size: 4361 bytes
Desc: not available
URL: <http://nginx.org/pipermail/nginx-devel/attachments/20100219/fa106fae/attachment.obj>


More information about the nginx-devel mailing list