0

Can someone explain why the following condition is failing? Seems like the last ) is cut off.

    location / {
        if ($request_uri !~ "(abc|def)" {
            return 404;
        }
    ...

fails with:

2021/10/07 13:29:50 [emerg] 183#183: pcre_compile() failed: missing ) in "(abc|def" in /usr/local/openresty/nginx/conf/conf.d/local.dev.conf:26
nginx: [emerg] pcre_compile() failed: missing ) in "(abc|def" in /usr/local/openresty/nginx/conf/conf.d/local.dev.conf:26

Funny enough, this seems to be "valid".

        if ($request_uri !~ "(abc|def))" {
            return 404;
        }
klodoma
  • 4,181
  • 1
  • 31
  • 42

1 Answers1

0

You are missing the closing ) of the if (.

if ($request_uri !~ "(abc|def)") {
    return 404;
}
slauth
  • 2,667
  • 1
  • 10
  • 18