0

I am trying to set proxy_pass based on $host value, I tried this:

location /api/v1/ {
    if ($host = .*\.npreprod.company.com)
    {
            proxy_pass https://frontend-api.preprod.company.com/api/v1/;
    }
}

however, I got the error

nginx: [emerg] "proxy_pass" cannot have URI part in location given by regular expression, or inside named location, or inside "if" statement, or inside "limit_except" block in /etc/nginx/sites-enabled/nuxtjs.conf:45

so, what's the proper way to achieve this?

Gerald Schneider
  • 25,025
  • 8
  • 61
  • 90
simo
  • 160
  • 2
  • 12

0 Answers0