proxy_cache_key + redirects

Taras Girnyk lists at ruby-forum.com
Wed Mar 3 21:49:01 MSK 2010


Hi, community.

I've installed nginx as proxy-caching server and now got such a problem.
One of backend is hosting magento websites, while trying to log in into
admin panel (url looks like http://.../admin) system want to send client
to url http://.../index.php/admin/dashboard but for some reason it is
already cached and i'm getting the previous page. For this setup i'm
using such configuration:

proxy_cache_key $scheme$uri$is_args$args;
proxy_cache_path /var/spool/nginx/tmp/cache levels=1:2
keys_zone=wholepage:1024m inactive=6h max_size=4096m;
proxy_cache wholepage;
proxy_read_timeout 200;
proxy_connect_timeout 75;
proxy_cache_valid 200 1h;
proxy_cache_valid 301 1h;
proxy_cache_valid any 0;

location / {
 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_pass http://.../;
 proxy_redirect   off;
}

Of course, with such setup when i load a.com and after 5 min load b.com
i see cached result from a.com. But with this login page i can't even
imagine why this to different urls is caching as the same one.

Also, if i add $host in proxy_cache_key i'm starting to get permanent
redirects.
When i'm trying to load www.a.com backend reports 302 Location:
http://www.a.com and this loop continious forever.

What i'm doing wrong and what proxy_cache_key i should use to get this
working properly?

I'm using nginx/0.8.19
-- 
Posted via http://www.ruby-forum.com/.



More information about the nginx mailing list