Welcome! Log In Create A New Profile

Advanced

How to change/add cookie in http request for sticky?

September 04, 2017 03:10PM
Hi all. So my situation is following:

I'm making some backend on java and using nginx as balancer (sticky module). Sticky uses cookie for identify current server which browser is working with. Browser sends such request as POST, OPTION, GET and so on. And all these request contain cookie with route parameter. Firstly route parameter is generated by sticky nginx and then browser use it fo following reqest.

My problem now is that frontend developers created DELETE request without cookie. But they can write route parameter as parameter of request. Something like that:

DELETE http://myserver.com/winter/user/john?route=12345
So this request can send on wrong upstream, because it hasn't cookie. My solution is to add parameter located in url to cookie in nginx. But i don't know why how to do it. My nginx:

upstream backend {
server backend1.example.com;
server backend2.example.com;

sticky secure httponly;
}

server {
...

location / {
proxy_pass http://backend;
...
}
}
proxy_set_header Cookie "route=$arg_route"; help me, doesn't it? Or is there another way?
Subject Author Posted

How to change/add cookie in http request for sticky?

Hasta-La-Vista_NN September 04, 2017 03:10PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 323
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready