Hi Francis I tried to set cookies like this
server { listen 80; server_name datanode02.bddev.test.net; error_log /var/log/nginx/error_for_bigdata.log info; access_log /var/log/nginx/http_access_for_bigdata.log main; ##here to check whether logged_in cookie was set if ($cookie_logged_in != "1") { auth_ldap "Restricted Space"; auth_ldap_servers bigdataldap; } location / { proxy_pass http://dev-datanode02:8042/; more_clear_headers "X-Frame-options"; add_header Set-Cookie "logged_in=1;Domain=.bddev.test.net;Path=/;Max-Age=315360000"; } } server { listen 80; server_name datanode03.bddev.test.net; error_log /var/log/nginx/error_for_bigdata.log info; access_log /var/log/nginx/http_access_for_bigdata.log main; ##here to check whether logged_in cookie was set if ($cookie_logged_in != "1") { auth_ldap "Restricted Space"; auth_ldap_servers bigdataldap; } location / { proxy_pass http://dev-datanode03:8042/; more_clear_headers "X-Frame-options"; add_header Set-Cookie "logged_in=1;Domain=.bddev.test.net;Path=/;Max-Age=315360000"; } } but nginx failed to start, seem it is not possible to set "if" block like this,do you know how to check whether cookie value? At 2019-03-22 16:03:23, "Francis Daly" <fran...@daoine.org> wrote: >On Fri, Mar 22, 2019 at 02:47:36PM +0800, David Ni wrote: > >Hi there, > >> Who can help with this?Thanks very much. > >The question looks very like the one at >https://forum.nginx.org/read.php?2,282620,282620 > >I presume that the answer remains the same. > >Which is: if "Domain" works for you, add it to the place that creates (or >causes to be sent to the client) the "Set-Cookie" http response header. > > f >-- >Francis Daly fran...@daoine.org >_______________________________________________ >nginx mailing list >nginx@nginx.org >http://mailman.nginx.org/mailman/listinfo/nginx
_______________________________________________ nginx mailing list nginx@nginx.org http://mailman.nginx.org/mailman/listinfo/nginx