Cookie Cleaning with Nginx
A few days ago, we discovered that there was some odd behavior with some traffic hitting our sites due to a cookie with a null name. It was causing some weirdness with our application and causing our alerting software to freak out. I was tasked with coming up with a solution to handling this. I dabble in the load balancing space and decided to solve this by stripping out the cookie in Nginx.
set $cookies $http_COOKIE;
if ($http_COOKIE ~* "(.*;)\s=deleted;(.*)") {
set $cookies $1$2;
}
proxy_set_header cookie $cookies;