Nginx: Reject request if header is not present or wrong
You can use two IF statements either before or in the location block to inspect the headers and then return a 403 error code if it is present. Alternatively, you can use those IF statements to rewrite to a specific location block and deny all in that location: if ($http_x_custom_header) { return 403; } Reference: … Read more