You may find yourself trying to bend NGINX's configuration directives in ways that they were not meant to be used. This is frequently seen in configurations where there are a lot of
if checks to try to emulate some sort of logic chain. A better option would be to use NGINX's embedded
perl module. With this module, you will be able to use the flexibility of Perl to achieve your configuration goals.
perl module is not built by default, so it needs to be enabled with the
--with-http_perl_module configure switch. Ensure as well that your Perl was built with
-Dusemymalloc=no. NGINX configuration reloads will cause the
perl module to leak memory over time, so this last parameter ...