proxy_ignore_headers doesn't seem to work

piotr nginx-forum at nginx.us
Sat Dec 17 15:19:29 UTC 2011


Maxim Dounin Wrote:
> Try "nginx -t".  If it doesn't help, please post
> the full config 
> you're testing with.
> 

Hi,

Maxim, thank you for your response!

I've checked both servers for config errors before, but without any
clues.


nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful



Current configuration:

***** cat /etc/nginx/nginx.conf 

user  nginx;
worker_processes  1;

error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;


events {
    worker_connections  1024;
}


http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;

    log_format  main  '$remote_addr - $remote_user [$time_local]
"$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    keepalive_timeout  5;

    #gzip  on;

    include /etc/nginx/conf.d/*.conf;
}


***** cat /etc/nginx/conf.d/proxy.conf 

	log_format cache '$remote_addr $time_local '
                   '$upstream_cache_status '
                   'proxy_host:$proxy_host '
                   'Cache-Control:$upstream_http_cache_control '
                   'Expires:$upstream_http_expires '
                   'upstream_server:$upstream_addr '
                   'upstream_status:$upstream_status '
                   '"$request" ($status) '
                   '"$http_user_agent" ';

	

	proxy_cache_path /home/mpqcache levels=1:2:2
keys_zone=mpqcache:30000m;
	
	upstream mpq_cluster {
		#ip_hash;
		server otile1.mqcdn.com:80;
		server otile2.mqcdn.com:80;
		server otile3.mqcdn.com:80;
		server otile4.mqcdn.com:80;
	}
		
	server {

		listen	80;
		server_name mpq1.XXX.com mpq2.XXX.com;

		access_log /var/log/nginx/mpq1.XXX.com_access.log cache;
		error_log /var/log/nginx/mpq1.XXX.com_error.log info;

		location / {
			#proxy_pass http://mpq_cluster;
			proxy_pass http://otile1.mqcdn.com;
			proxy_set_header Host otile1.mqcdn.com;
			proxy_ignore_headers X-Accel-Expires Expires Cache-Control
Set-Cookie;
			proxy_cache mpqcache;
			proxy_cache_key "$scheme$host$request_uri";
			proxy_cache_valid 200 302 600h;
			proxy_cache_valid any 90m;
		}

	} # server
	
	
	
***** sample headers from upstream server:

http://otile3.mqcdn.com/tiles/1.0.0/osm/15/5240/12661.jpg

GET /tiles/1.0.0/osm/15/5240/12661.jpg HTTP/1.1
Host: otile3.mqcdn.com
User-Agent: Mozilla/5.0 (Ubuntu; X11; Linux i686; rv:8.0) Gecko/20100101
Firefox/8.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en,en-us;q=0.7,pl;q=0.3
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-2,utf-8;q=0.7,*;q=0.7
Connection: keep-alive
If-Modified-Since: Tue, 13 Dec 2011 06:16:41 GMT

HTTP/1.1 304 Not Modified
Content-Type: image/jpeg
Expires: Fri, 16 Dec 2011 14:16:45 GMT
Last-Modified: Tue, 13 Dec 2011 06:16:41 GMT
Cache-Control: max-age=600
Date: Fri, 16 Dec 2011 14:06:45 GMT
Connection: keep-alive


***** sample headers from nginx proxy
http://mpq1.XXX.com/tiles/1.0.0/osm/15/5240/12661.jpg

GET /tiles/1.0.0/osm/15/5240/12661.jpg HTTP/1.1
Host: mpq1.XXX.com
User-Agent: Mozilla/5.0 (Ubuntu; X11; Linux i686; rv:8.0) Gecko/20100101
Firefox/8.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: en,en-us;q=0.7,pl;q=0.3
Accept-Encoding: gzip, deflate
Accept-Charset: ISO-8859-2,utf-8;q=0.7,*;q=0.7
Connection: keep-alive
Cookie: bblastvisit=1323941196; bblastactivity=0;
__qca=P0-811271075-1323941200190;
__utma=26892847.397077741.1323941200.1323964564.1324035857.4;
__utmz=26892847.1323941200.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none);
bbuserid=33280; bbpassword=be7f8ba39107f78fb42020ad76ca953b;
__utmc=26892847; bbsessionhash=0d7cdd74637b9f503c4f33d7ad1f8394

HTTP/1.1 200 OK
Server: nginx/1.0.10
Date: Fri, 16 Dec 2011 14:08:43 GMT
Content-Type: image/jpeg
Connection: keep-alive
Expires: Wed, 14 Dec 2011 14:59:21 GMT
Last-Modified: Tue, 13 Dec 2011 06:16:41 GMT
Cache-Control: max-age=600
Content-Length: 18419





Thanks!


Regards,
P.

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,220058,220164#msg-220164



More information about the nginx mailing list