PHP headers: Cache-control and expired disappears?
April 27, 2010 08:56AM
Hi,

Any ideas why I can't get Cache-control / expired headers from PHP to client?
They seems to disappear on the way.

I have tried to set these in php, but none of those goes trough.

"Content-type: application/json; charset=utf-8"
"Cache-Control: no-store, no-cache, must-revalidate"
"Pragma: no-cache"
"Expires: Sat, 1 Jan 2005 00:00:00 GMT"

Here is the responce from the server:
Cache-Control:proxy-revalidate
Connection:Keep-Alive
Content-Encoding:gzip
Content-Type:text/html; charset=utf-8
Date:Tue, 27 Apr 2010 12:51:48 GMT
Proxy-Connection:Keep-Alive
Server:nginx
Transfer-Encoding:chunked
Vary:Accept-Encoding

Running Nginx 7.65 + php-fpm + php 5.2.9

Nginx configuration is something like this:

http {
ignore_invalid_headers on;
limit_zone gulag $binary_remote_addr 2m;
recursive_error_pages on;
sendfile on;
server_name_in_redirect off;
server_tokens off;

tcp_nodelay on;
tcp_nopush on;

[b]upstream php_socket {
server unix:/tmp/php.socket;
server unix:/tmp/php1.socket;
}[/b]

gzip on;
gzip_buffers 16 8k;
gzip_comp_level 9;
gzip_http_version 1.1;
gzip_min_length 0;
gzip_proxied any;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript image/x-icon image/png;
gzip_vary on;

server {
listen 80;
server_name jadajada.com;
charset utf-8;

location /index.php {
set $script $uri;
set $path_info "";

if ($uri ~ "^(.+\.php)(/.+)") {
set $script $1;
set $path_info $2;
}

include /usr/local/nginx/conf/fastcgi_params;

fastcgi_pass [b]php_socket[/b];
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_param REDIRECT_STATUS 200;
Sorry, only registered users may post in this forum.

Click here to login

Online Users

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