0

I have two locations '/mysite/india' and '/mysite/usa' that share same definition. I know I can specify this using regex (without ^). which I do not want to use as this is a very frequently hit endpoint. Anotehr way to is to duplicate the whole block with two exact matches(/mysite/usa and /mysite/india). I am wondering if there is a way to use 'preferred prefix' instead? I tried following with https://nginx.viraptor.info/ and it doesn't work. Is this syntax wrong or is this just not supported?

server {
 listen       80;
 server_name  mydomain.com www.mydomain.com;
 access_log   logs/mydomain.access.log  main;
 
location ^~ /mysite(/usa|/india)$
{
  root    /var/www/virtual/big.server.com/htdocs;
  expires 30d;
 }

 location / {
  proxy_pass      http://127.0.0.1:8080;
 }
}
bladeWalker
  • 978
  • 1
  • 13
  • 30

0 Answers0