nginx how to check the value of optional header
how do check for the value of a optional header in nginx?
I was thinking of using a map function,
map $http_optional_header $is_header_valid {
default 0;
"true" 1;
"Y" 1;
"false" 1;
"N" 1;
}
if ($is_header_valid = 0){
return 400 }
however, in the default case if header is missing the checks fails, making the header mandatory, but if I make default value as 1, any value would be valid, how do I check the header in nginx so that if the header is not present, we will use header value as false, but if the header is present, the value has to be one of the above else we throw an error?
Read more here: Source link
