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
on 2010-03-03 19:49
on 2010-03-03 20:26
On Wed, 2010-03-03 at 19:49 +0100, Taras Girnyk wrote: > 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. Unfortunately nginx site lacks sane examples. If you happen to have Host: header based virtual servers on the same backend and you don't use separate nginx server {} sections for those virtuals on the frontend, you want to use $host variable within proxy_cache_key. I use proxy_cache_key $scheme://$host$request_uri; > Also, if i add $host in proxy_cache_key i'm starting to get permanent > redirects. This may be the side effect of the application on the backend, which behaves this way when it cannot set cookies ( doesn't receive it after trying to set it ). Use proxy_pass_header Set-Cookie; within your proxying location / {} -- Miroslaw "Psyborg" Jaworski GCS/IT d- s+:+ a C++$ UBI++++$ P+++$ L- E--- W++(+++)$ N++ o+ K- w-- O- M- V- PS+ PE++ Y+ PGP t 5? X+ R++ !tv b++(+++) DI++ D+ G e* h++ r+++ y?
on 2010-03-03 21:03
> I use > proxy_cache_key $scheme://$host$request_uri; > Yes, i done this to be able at least to test something. > proxy_pass_header Set-Cookie; > within your proxying location / {} Thank you for your reply, i just find this solution half an hour ago, i was trying to do this with all Cookie-commands possible which i found over the web, finally came to this solution and all is working fine now. Anyway, thanks.
Please log in before posting. Registration is free and takes only a minute.
Existing account
(Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
Log in with Google account | Log in with Yahoo account
No account? Register here.