nginx redirects URL based on COOKIE information and converts COOKIE to QUERYSTRING

location /{
	set $ody_cookie "";
	if ($http_cookie ~* "ody_ab_gray_group=(.*)"){
		set $ody_cookie "ody_ab_gray_group=$1";
	}
	if ($query_string ~* "^\?.*"){
		rewrite ^(.*)  ^$1&$ody_cookie break;
	}
	if ($query_string !~ "^\?.*"){
		rewrite ^(.*)  ^$1?$ody_cookie break;
	}
    proxy_pass http://localhost:8080;
    proxy_set_header Host $host:80;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For  $remote_addr;
    break;
}

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326124470&siteId=291194637