ПРОЕКТЫ 


  АРХИВ 


Apache-Talk @lexa.ru 

Inet-Admins @info.east.ru 

Filmscanners @halftone.co.uk 

Security-alerts @yandex-team.ru 

nginx-ru @sysoev.ru 


  СТАТЬИ 


  ПЕРСОНАЛЬНОЕ 


  ПРОГРАММЫ 



ПИШИТЕ
ПИСЬМА












     АРХИВ :: nginx-ru
Nginx-ru mailing list archive (nginx-ru@sysoev.ru)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

proxy cache bypass и 303 see other


  • To: nginx-ru@xxxxxxxxx
  • Subject: proxy cache bypass и 303 see other
  • From: "commeta" <nginx-forum@xxxxxxxx>
  • Date: Sun, 14 Jul 2013 10:53:03 -0400
  • Dkim-signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=helium.jlkhosting.com; s=x; h=Date:Sender:From:Message-ID:Content-Transfer-Encoding:Content-Type:Subject:To; bh=B9mBkXo4tQtBvnwYiXYHrvPqVE2RVc4nLwLjj1qSfA8=; b=kF6X4Tt5aw13GAPowUN71sMBwCl5tCswF/wyN3CIqb5lAa8yurF/WiD2CiOvTqVdDwWFil+AWM/TqkTQRATLqyjU2CBh1Wvob0m+/ULwbrZ4UGJCGXvcrFZ56yrP3pfaCcCevZind3e36A+TA5tsxVO5VvMFSv6rPn3ST2QZD64=;

Здравствуйте,
Подскажите как сделать конструкцию для отключения кэширования страницы
открывающейся по 303 see other?
на подобии:

if ( $http_responce = 303 ) { 
set $do_not_cache 1; 
} 
proxy_cache_bypass $do_not_cache;


Предистория:

nginx version: nginx/1.0.15
CentOs 6 
Linux 2.6.32-358.2.1.el6.x86_64 #1 SMP Wed Mar 13 00:26:49 UTC 2013 x86_64
x86_64 x86_64 GNU/Linux


nginx установлен в качестве прокси для apache2 + отдача статики.
Возникла необходимость кешировать один из сайтов, в результате родился такой
конфиг:
/etc/nginx/nginx.conf      

user apache;
worker_processes  4;
error_log  /var/log/nginx/error.log;
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;
    keepalive_timeout  85;
    proxy_cache_path /var/cache/nginx levels= keys_zone=wholepage:500m;

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

        include /usr/local/ispmgr/etc/nginx.domain;
        client_max_body_size 64M;
        log_format isp '$bytes_sent $request_length';

        server {
                server_name test3.mysite.ru www.test3.mysite.ru;
                listen 33.133.9.32;
                set $root_path /var/www/mysite.ru/data/www/test3.mysite.ru;
                location ~*
^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf)$ {
                        root $root_path;
                        access_log /var/www/nginx-logs/mysite.ru isp;
                        access_log 
/var/www/httpd-logs/test3.mysite.ru.access.log ;
                        error_page 404 = @fallback;
                }
                location / {
                        if ($request_method = POST) { set $do_not_cache 1; } 
                        if ($cookie_session) { set $do_not_cache 1; } 
                        proxy_cache_bypass $do_not_cache;
                        
                        proxy_pass http://33.133.9.32:81;
                        proxy_redirect http://33.133.9.32:81/ /;
                        
                        proxy_hide_header "Set-Cookie";
                        proxy_ignore_headers "Cache-Control" "Expires" 
"Set-Cookie";
                        
                        proxy_set_header Host $host;
                        proxy_set_header X-Forwarded-For 
$proxy_add_x_forwarded_for;
                        proxy_set_header X-Forwarded-Proto $scheme;
                        proxy_set_header X-Real-IP $remote_addr;

                        proxy_cache wholepage;
                        proxy_cache_valid 200 301 302 304 5m;
                        proxy_cache_key
"$request_method|$http_if_modified_since|$http_if_none_match|$host|$request_uri";
                }
                                                                
                location ~* ^/(webstat|awstats|webmail|myadmin|pgadmin)/ {
                        proxy_pass http://33.133.9.32:81;
                        proxy_redirect http://33.133.9.32:81/ /;
                        proxy_set_header Host $host;
                        proxy_set_header X-Forwarded-For 
$proxy_add_x_forwarded_for;
                        proxy_set_header X-Forwarded-Proto $scheme;
                        proxy_set_header X-Real-IP $remote_addr;
                }
                location @fallback {
                        proxy_pass http://33.133.9.32:81;
                        proxy_set_header Host $host;
                        proxy_set_header X-Forwarded-For 
$proxy_add_x_forwarded_for;
                        proxy_set_header X-Forwarded-Proto $scheme;
                        proxy_set_header X-Real-IP $remote_addr;
                }
                location ^~ /webstat/ {
                        auth_basic "Restricted area";
                        auth_basic_user_file 
/var/www/mysite.ru/data/etc/3677707.passwd;
                        try_files $uri @fallback;
                }
                location ~*
^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|avi|zip|gz|bz2?|rar|swf|ico)$
{
                        root $root_path;
                        access_log /var/www/nginx-logs/mysite.ru isp;
                        access_log 
/var/www/httpd-logs/test3.mysite.ru.access.log ;
                        error_page 404 = @fallback;
                }
                include /usr/local/ispmgr/etc/nginx.inc;
        }
        server_names_hash_max_size 8192;
}

на сайте есть корзина, при нажатии на ссылку открывается страница с кодом
303 see other, мне нужно чтобы страница которая по 303 вернулась не
кэшаровалась, как это сдлеать?

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?21,240829,240829#msg-240829

_______________________________________________
nginx-ru mailing list
nginx-ru@xxxxxxxxx
http://mailman.nginx.org/mailman/listinfo/nginx-ru


 




Copyright © Lexa Software, 1996-2009.