Welcome! Log In Create A New Profile

Advanced

bug with X-Accel-Expires 0 ?

Jérôme Loyet
February 20, 2010 11:36AM
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.

_______________________________________________
nginx mailing list
nginx@nginx.org
http://nginx.org/mailman/listinfo/nginx
Subject Author Posted

bug with X-Accel-Expires 0 ?

Jérôme Loyet February 20, 2010 11:36AM

RE: Nginx ESI Module

Kingsley Foreman February 20, 2010 11:36AM

Re: Nginx ESI Module

Todd Fisher February 20, 2010 11:36AM

RE: Nginx ESI Module

Kingsley Foreman February 20, 2010 11:36AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 306
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready