Nginx-ru mailing list archive (nginx-ru@sysoev.ru)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: почему ответы бэекенда могут не кешироваться ?
- To: nginx-ru@xxxxxxxxx
- Subject: Re: почему ответы бэекенда могут не кешироваться ?
- From: Валера Харсеко <vharseko@xxxxxxxxx>
- Date: Wed, 18 May 2011 13:15:07 +0400
- Dkim-signature: v=1; a=rsa-sha256; c=simple/relaxed; d=xxlive.ru; h=from :mime-version:content-type:subject:date:in-reply-to:to :references:message-id; q=dns/txt; s=default; i= vharseko@xxxxxxxxx; t=1305710099; x=1305796499; bh=kCrRT0cn+gC3+ wBXNQCLqBXSGIHwuUWN0HsuxO0kfYk=; b=XSd3xkvmVshRHmRIC9gBG32P6Forp ohANMdYM9nO/12cOLEwCF1VPKx+osnHM7ALYChmb7XZvLjantoDiNRq1arGV4irF 5M501okT5+Rg2qa1wEC8T/cCN2j+yu9On7WUtornRf3zfpjgJM/KzYeTRqOfxIDl pYiAgdHX/40xNM=
- Domainkey-signature: a=rsa-sha1; c=simple; d=xxlive.ru; h=from :mime-version:content-type:subject:date:in-reply-to:to :references:message-id; q=dns; s=default; b=s4n6Pe2s6cK2bEkjAlVI kEK5eA4Oh0Trr1G8zTsVpX9yeWdEUlqmUjJjUjcECLQPSeI7aCEHV0RAPpxNQ/a5 Rsd8bUyLLTnQCIISownYVsrbbWVjLYYUoYdKguoqBB3nmCDI12h2zfMMPG54H8U4 v4gdIm2Xfr0SJ1qX0EBxs5s=
- In-reply-to: <921CB1BD-9C1A-488A-A2B1-1390C66660A4@xxxxxxxxx>
- References: <921CB1BD-9C1A-488A-A2B1-1390C66660A4@xxxxxxxxx>
нет ни у кого мыслей ?
вот примеры ответов бэкенда, который nginx не кладет в кеш:
> location ~* ^.*/image\.flag\.aspx$ {
> proxy_pass http://shops;
> proxy_cache TST;
> proxy_cache_key $request_uri;
> proxy_cache_valid 200 30d;
> }
HTTP/1.1 200 OK
Cache-Control: public
Content-Type: image/gif
Last-Modified: Wed, 18 May 2011 08:52:18 GMT
Server: Microsoft-IIS/7.5
Set-Cookie: countrycode2=ru; expires=Sun, 18-May-2014 08:52:18 GMT; path=/
X-AspNet-Version: 4.0.30319
Date: Wed, 18 May 2011 08:52:18 GMT
Content-Length: 962
> location /yml.xml {
> proxy_pass http://shops;
> proxy_cache TST;
> proxy_cache_key $host$request_uri;
> proxy_cache_valid 200 1d;
> }
HTTP/1.1 200 OK
Cache-Control: private
Transfer-Encoding: chunked
Content-Type: text/xml; charset=utf-8
Content-Encoding: gzip
Expires: Thu, 19 May 2011 08:55:55 GMT
Last-Modified: Wed, 18 May 2011 08:55:55 GMT
Vary: Accept-Encoding
Server: Microsoft-IIS/7.5
Set-Cookie: ix_person_guid=708dff8a-d62a-4db5-a1dc-1b3970bd10ca; expires=Wed,
18-May-2016 08:55:55 GMT; path=/; HttpOnly
Content-Disposition: attachment; filename=yml.xml;
X-AspNet-Version: 4.0.30319
Date: Wed, 18 May 2011 08:56:27 GMT
а вот эти кладет:
> location ~* ^.+\.(jpg|jpeg|gif|js|css|doc|ico|cur|png)$ {
> proxy_pass http://shops;
> proxy_cache SHOPS;
> proxy_cache_key $host$request_uri;
> proxy_cache_valid 200 30d;
> }
HTTP/1.1 200 OK
Cache-Control: public
Content-Type: image/png
Last-Modified: Wed, 18 May 2011 08:52:18 GMT
Server: Microsoft-IIS/7.5
X-AspNet-Version: 4.0.30319
Date: Wed, 18 May 2011 08:52:18 GMT
Content-Length: 17198
18.05.2011, в 0:31, Валера Харсеко написал(а):
> Заметил, что не весь контент кешируется как задано директивами, например зона
> SHOPS работает а TST пустая (сделана для удобства проверки)
> Думаю, что дело в ответных заголовках или в их отсутствии от бэкенда.
> Какие именно заголовки проверять ?
>
>
> proxy_cache_path /var/cache/nginx/shop levels=1:2 keys_zone=SHOPS:1024m
> inactive=3d max_size=20g;
> proxy_cache_path /var/cache/nginx/TST2 levels=1:2 keys_zone=TST:1024m
> inactive=3d max_size=20g;
>
> location ~* ^.*/img.+\.png$ {
> proxy_pass http://shops;
> proxy_cache SHOPS;
> proxy_cache_key $host$request_uri;
> proxy_cache_valid 200 10d;
> }
> location ~* ^.+\.(jpg|jpeg|gif|js|css|doc|ico|cur|png)$ {
> proxy_pass http://shops;
> proxy_cache SHOPS;
> proxy_cache_key $host$request_uri;
> proxy_cache_valid 200 30d;
> }
> location ~* ^.*/image\.flag\.aspx$ {
> proxy_pass http://shops;
> proxy_cache TST;
> proxy_cache_key $request_uri;
> proxy_cache_valid 200 30d;
> }
> location /yml.xml {
> proxy_pass http://shops;
> proxy_cache TST;
> proxy_cache_key $host$request_uri;
> proxy_cache_valid 200 1d;
> }
> proxy_redirect off;
> proxy_set_header Host $host;
> proxy_set_header X-Real-IP $remote_addr;
> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> proxy_connect_timeout 70;
> proxy_send_timeout 90;
> proxy_read_timeout 600;
> proxy_buffering on;
> proxy_cache off;
> proxy_buffer_size 4k;
> proxy_buffers 4 32k;
> proxy_busy_buffers_size 64k;
> proxy_temp_file_write_size 64k;
> proxy_temp_path /var/cache/nginx/proxy_temp 1 2 3;
> proxy_ignore_client_abort off;
> proxy_intercept_errors on;
> proxy_cache_use_stale error updating timeout invalid_header
> http_500 http_502 http_503 http_504;
>
> client_max_body_size 10m;
> client_body_buffer_size 128k;
> client_body_temp_path /var/cache/nginx/client_body_temp 1 2
> 3;_______________________________________________
> nginx-ru mailing list
> nginx-ru@xxxxxxxxx
> http://nginx.org/mailman/listinfo/nginx-ru
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
nginx-ru mailing list
nginx-ru@xxxxxxxxx
http://nginx.org/mailman/listinfo/nginx-ru
|