Welcome! Log In Create A New Profile

Advanced

Nginx overwrite existing cookies with add_header

August 25, 2016 03:24PM
So i am using Nginx to set a header now my PHP app sets this header too but it sets the cookie with a domain of ".networkflare.com"

Nginx keeps setting it as "www.networkflare.com" i need to overwrite the cookie not create a new one.

I have tried the following :

add_header Set-Cookie "logged_in=1;Path=/;Max-Age=315360000";


That created a new cookie with a domain of "www.networkflare.com" instead of overwriting the previous cookie with a domain of ".networkflare.com"

This is also has the same outcome as above.

add_header Set-Cookie "logged_in=1;Domain=$host;Path=/;Max-Age=315360000";



Does anyone know how you can overwrite the existing cookie without having to specify the add_header like this.

add_header Set-Cookie "logged_in=1;Domain=.networkflare.com;Path=/;Max-Age=315360000";
The reason i can't use this method is because on the Nginx server there are multiple hosts, it is why i try to use $host but would need to remove the www at the start for it to work.

http://www.networkflare.com/
Subject Author Posted

Nginx overwrite existing cookies with add_header

c0nw0nk August 25, 2016 03:24PM

Re: Nginx overwrite existing cookies with add_header

c0nw0nk August 25, 2016 04:06PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 182
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