Welcome! Log In Create A New Profile

Advanced

Re: Proxy cache for php site

Francis Daly
November 08, 2011 04:30PM
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
--
Francis Daly francis@daoine.org

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

Proxy cache for php site

Jon Bennett October 15, 2011 07:42PM

Re: Proxy cache for php site

António P. P. Almeida October 15, 2011 08:52PM

Re: Proxy cache for php site

Jon Bennett October 15, 2011 09:18PM

Re: Proxy cache for php site

António P. P. Almeida October 15, 2011 10:56PM

Re: Proxy cache for php site

Jon Bennett October 16, 2011 08:26AM

Re: Proxy cache for php site

Jon Bennett October 16, 2011 07:04PM

Re: Proxy cache for php site

lpugoy November 08, 2011 07:55AM

Re: Proxy cache for php site

Francis Daly November 08, 2011 04:30PM

Re: Proxy cache for php site

Maxim Dounin November 08, 2011 04:32PM

Re: Proxy cache for php site

lpugoy November 09, 2011 06:02AM

Re: Proxy cache for php site

lpugoy November 09, 2011 08:18AM

Re: Proxy cache for php site

lpugoy November 10, 2011 02:50AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 123
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