javascript - Cookies are not sent with request in nginx -
i have problem cookies, nginx , backend server.
what achieve this:
nginx @ port 70 location / { if session cookie not set return 301 localhost/login.html else proxy_pass http://somewhere } location /login.html{ proxy_pass http://localhost:8080 <- backend server logging @ localhost:8080/login.html } location /redirection/ { return 301 localhost:70 }
so should go login.html , proxy pass logging server localhost:8080/login.html , can log in. process credentials , redirect /redirection/ in form action (processing done in javascript - it's setting cookies only). after being in redirection server should send request itself, has session cookie it's going http://somewhere.
but mine problem in login.html cookies should set, aren't. if i'm going localhost:8080/login.html alone , try - cookies work well. somehow proxy_pass
cookies lost.
p.s if use 2 server block , /login.html , /redirection on second server works well, can't have 2 server blocks in configuration - need have on 1 port.
well... did resolve issue.. said js script setting mine cookies. seems js scripts didn't load went straight ahead "/" location. did was:
location /js/ { proxy_pass http://localhost:8080; }
with working.
so remember.. if html files on backend server contain css/js files need take account that.
Comments
Post a Comment