У меня есть бекенд, который любит всегда возвращать Set-Cookie. Я от него получаю X-Accel-Redirect и хочу чтобы в ответе от Nginx не было Set-Cookie. У меня не получается этого добиться.
$ nginx -V
nginx version: nginx/1.4.7
TLS SNI support enabled
configure arguments: --prefix=/opt/local --with-cc-opt='-I/opt/local/include -Os' --with-ld-opt='-L/opt/local/lib -Wl,-headerpad_max_install_names' --conf-path=/opt/local/etc/nginx/nginx.conf --error-log-path=/opt/local/var/log/nginx/error.log --http-log-path=/opt/local/var/log/nginx/access.log --pid-path=/opt/local/var/run/nginx/nginx.pid --lock-path=/opt/local/var/run/nginx/nginx.lock --http-client-body-temp-path=/opt/local/var/run/nginx/client_body_temp --http-proxy-temp-path=/opt/local/var/run/nginx/proxy_temp --http-fastcgi-temp-path=/opt/local/var/run/nginx/fastcgi_temp --http-uwsgi-temp-path=/opt/local/var/run/nginx/uwsgi_temp --with-ipv6 --with-http_gzip_static_module --with-http_image_filter_module --with-http_perl_module --with-perl=/opt/local/bin/perl --with-http_realip_module --with-http_secure_link_module --with-http_ssl_module --with-http_stub_status_module
server {
server_name _;
listen *:80;
location /a {
proxy_hide_header Set-Cookie;
proxy_ignore_headers "Set-Cookie";
proxy_pass http://r9:5000/api/5;
}
location /b {
proxy_hide_header Set-Cookie;
proxy_ignore_headers "Set-Cookie" "X-Accel-Redirect";
proxy_pass http://r9:5000/api/5;
}
location /_x {
add_header X-Uri $uri;
return 204;
}
}
Результаты:
$ curl -i http://127.0.0.1/a
HTTP/1.1 204 No Content
Server: nginx/1.4.7
Date: Wed, 30 Apr 2014 10:12:15 GMT
Connection: keep-alive
Set-Cookie: PLAY_SESSION="bcf94e2996bcb8885056bea401ffb0f53dd44577-csrfToken=55a3490742002528628151751e509e57316a92b8-1398852735621-c5dae9d9b61fddafa51a0ba3"; Path=/; HTTPOnly
X-Uri: /_x/5
$ curl -i http://127.0.0.1/b
HTTP/1.1 204 No Content
Server: nginx/1.4.7
Date: Wed, 30 Apr 2014 10:12:17 GMT
Content-Length: 0
Connection: keep-alive
Можно ли вырезать Set-Cookie от сервера, вернувшего X-Accel-Redirect?
С уважением,
Александр