atom feed12 messages in ru.sysoev.nginxRe: Proxy cache for php site
FromSent OnAttachments
Jon BennettOct 15, 2011 4:39 pm 
António P. P. AlmeidaOct 15, 2011 5:49 pm 
Jon BennettOct 15, 2011 6:15 pm 
António P. P. AlmeidaOct 15, 2011 7:53 pm 
Jon BennettOct 16, 2011 5:24 am 
Jon BennettOct 16, 2011 4:01 pm 
lpugoyNov 8, 2011 8:56 am 
Francis DalyNov 8, 2011 1:28 pm 
Maxim DouninNov 8, 2011 1:30 pm 
lpugoyNov 9, 2011 3:02 am 
lpugoyNov 9, 2011 5:18 am 
lpugoyNov 9, 2011 11:49 pm 
Subject:Re: Proxy cache for php site
From:Francis Daly (fran@daoine.org)
Date:Nov 8, 2011 1:28:32 pm
List:ru.sysoev.nginx

On Tue, Nov 08, 2011 at 11:56:53AM -0500, lpugoy wrote:

Hi there,

I'm sorry, but I don't understand the effect of cookies on proxy caching.

Caching involves fetching something once from the backend, and then sending the same response to many requests.

A cookie is something that is set differently per request.

If you have one, you don't have the other.

By default.

I'm trying to implement the same configuration as the one referred to, and I'm also having trouble in that it doesn't seem to be caching. I'm also using httperf. For every request the backend does return a different cookie. Is this what is preventing the caching from happening?

Probably.

There are (rfc) rules on caching and cacheability of a http response -- but be aware that not all of them apply to a reverse proxy like nginx.

Look at the http headers sent from your backend. If they indicate that the response is not cacheable, nginx won't cache it -- unless you configure it to. Setting a cookie is one way to make a response non-cacheable.

If you don't want the cookie set, don't set it.

Out-of-the-box, nginx obeys the rules. Get your backend to obey the rules too, and it will all work fine.

If you won't do that, then you can (probably) configure nginx to break the rules in the specific way that you want it to when proxying your backend.

For example, if the backend sets a cookie and you want nginx to cache that, do you want it to set the same cookie for all requests; or to set no cookie for all requests; or something else?

You're likely much better off fixing the backend.

Good luck,

f