nginx cache seems to swallow Set-Cookie
pertl
nginx-forum at nginx.us
Thu Sep 2 17:02:15 MSD 2010
I run nginx 0.7.67 as a frontend proxy and cache for my Java application
running on jetty 7 using proxy_pass and proxy_cache.
nginx runs on port 80, the java app on 8080.
The very first thing the java application does when I call it in the
browser ( http://localhost ) is create a new http session and send a 302
redirect to the login page. The response contains a new "Set-Cookie:
JSESSIONID=65omgcih3oif15g2yc1szsos;Path=/" with some new random session
ID. The 302 also contains a "Cache: no-cache" so the 302 temporary
redirect never gets cached which is what we want.
Now what I experience is that nginx returns the java app server response
with all but the "Set-Cookie". It's definitely there and nginx
definitely removes it.
This is a real pain and will break my app (and possible others).
So is there such a thing like a "cookie-stripper-during-http-status-302"
?
this is my config:
----------------------------
user nobody nogroup;
worker_processes 4;
error_log logs/error.log info;
pid logs/nginx.pid;
events {
worker_connections 256;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
gzip on;
gzip_comp_level 2;
gzip_proxied any;
gzip_min_length 1100;
gzip_buffers 16 8k;
gzip_types text/plain text/css application/x-javascript text/xml
application/xml application/xml+rss text/javascript image/gif image/jpeg
image/png;
upstream jetty {
ip_hash;
server localhost:8080;
# more will follow
}
proxy_temp_path /usr/local/nginx-0.7.67/tmp;
proxy_cache_path /usr/local/nginx-0.7.67/cache/default levels=1:2
keys_zone=default:8m max_size=1000m inactive=600m;
proxy_cache_valid 200 302 60s;
proxy_cache_key "$scheme://$host$request_uri";
server
{
listen 80;
listen [::]:80 default ipv6only=on;
location / {
proxy_cache default;
proxy_pass http://jetty/;
proxy_redirect default;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
}
Posted at Nginx Forum: http://forum.nginx.org/read.php?2,126312,126312#msg-126312
More information about the nginx
mailing list