Is there a way to check if a specific cookie exist in nginx
?
For now I have a section like below to set header from cookie:
proxy_set_header x-client-id $cookie_header_x_client_id;
I want to check if that cookie exist then set the header, otherwise do not override header.
I've tried:
if ($cookie_header_x_client_id) {
proxy_set_header x-client-id $cookie_header_x_client_id;
}
But it does not work and gives the error below:
"proxy_set_header" directive is not allowed here in /etc/nginx/sites-enabled/website:45
Any solution?