Welcome! Log In Create A New Profile

Advanced

Order of HTTP headers change cache behaviour

Simone Fumagalli
February 22, 2012 11:06AM
Hello.

Looking at my log I've noticed that some pages were not cached. After a bit of debugging I've noticed that the order in which the HTTP header are returned from Apache change how NGINX this save the page in the cache

So a page with this code is *NOT* cached

<?php

header('Content-Type: text/html; charset=UTF-8');
header('Last-Modified: Wed, 22 Feb 2012 14:44:11 GMT');
header('Expires: Wed, 11 Jan 1984 05:00:00 GMT');
header("X-Accel-Expires: 600");
header('Cache-Control: no-cache, must-revalidate, max-age=0');
header('Pragma: no-cache');

Echo "Hello World !";

?>

if I comment/delete the line header('Expires: Wed, 11 Jan 1984 05:00:00 GMT'); the page is cached.

Even if I move header("X-Accel-Expires: 600") before header('Expires: Wed, 11 Jan 1984 05:00:00 GMT'); the page is cached
Same thing happen for the header Cache-Control. If is before X-Accel-Expires the page is not cached if is after it is !

The conf for NGINX is very standard and proxy_cache_valid is not specified.

Is this correct ? Where am I wrong ?

Thanks

--
Simone



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

Order of HTTP headers change cache behaviour

Simone Fumagalli February 22, 2012 11:06AM

Re: Order of HTTP headers change cache behaviour

Maxim Dounin February 22, 2012 11:30AM

Re: Order of HTTP headers change cache behaviour

Simone Fumagalli February 22, 2012 11:40AM

Re: Order of HTTP headers change cache behaviour

Maxim Dounin February 22, 2012 12:06PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 308
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready