Opened 5 years ago

Closed 5 years ago

#1784 closed defect (invalid)

Pass cookie between `location`

Reported by: dmitryluhtionov@… Owned by:
Priority: minor Milestone:
Component: other Version: 1.15.x
Keywords: cookie Cc:
uname -a: FreeBSD m18.cabletv.dp.ua 12.0-STABLE FreeBSD 12.0-STABLE r346025 GENERIC amd64
nginx -V: nginx version: nginx/1.16.0
built with OpenSSL 1.1.1a-freebsd 20 Nov 2018 (running with OpenSSL 1.1.1b-freebsd 26 Feb 2019)
TLS SNI support enabled
configure arguments: --prefix=/usr/local/etc/nginx --with-cc-opt='-I /usr/local/include' --with-ld-opt='-L /usr/local/lib' --conf-path=/usr/local/etc/nginx/nginx.conf --sbin-path=/usr/local/sbin/nginx --pid-path=/var/run/nginx.pid --error-log-path=/var/log/nginx/error.log --user=www --group=www --modules-path=/usr/local/libexec/nginx --with-file-aio --http-client-body-temp-path=/var/tmp/nginx/client_body_temp --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi_temp --http-proxy-temp-path=/var/tmp/nginx/proxy_temp --http-scgi-temp-path=/var/tmp/nginx/scgi_temp --http-uwsgi-temp-path=/var/tmp/nginx/uwsgi_temp --http-log-path=/var/log/nginx/access.log --with-http_v2_module --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-pcre --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --without-mail_imap_module --without-mail_pop3_module --without-mail_smtp_module --with-mail_ssl_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-threads --with-mail=dynamic --with-stream=dynamic

Description

Конфигурация сервера приведена ниже.
С помощью браузера сначала делаем запрос "/auth"
при этом в заголовке отдаются cookie (видно на скриншоте)
После этого в браузере делаем запрос "/"
И при выполнении секции location /check, вызываемой из auth_request /check/;, в нее уже не передаются cookie.

Конфигурация сервера:

server {

listen 80;
server_name localhost;

location /auth {

proxy_pass http://auth;

}

location /check {

internal;
proxy_pass http://auth;
proxy_pass_request_body off;
proxy_set_header Content-Length "";

}

location / {

rewrite /$ /main/desktop/;
auth_request /check/;
proxy_pass http://ui-web;
auth_request_set $user $upstream_http_remote_user;
proxy_set_header Remote-User $user;

}

}

Attachments (1)

photo_2019-05-23_12-50-26.jpg (99.8 KB ) - added by dmitryluhtionov@… 5 years ago.
screenshot

Download all attachments as: .zip

Change History (2)

by dmitryluhtionov@…, 5 years ago

screenshot

comment:1 by Maxim Dounin, 5 years ago

Resolution: invalid
Status: newclosed

Директива auth_request делает внутренний подзапрос, и заголовки запроса там будут такие же, как в исходном запросе от клиента, то есть в запросе к "/". Передаст или не передаст клиент в этом запросе интересующие вас cookie - зависит не от nginx'а.

Note: See TracTickets for help on using tickets.