Nginx: allow access only to referrer that match location name
location ~ ^/([a-zA-Z0-9\.\-]*)/(.*) {
if ($http_referer !~ "^$1.*$"){
return 403;
}
}
location /india/xxxxx.js {
if ($http_referer !~ "http://domain.xxx/"){
return 403;
}
}
I solved my problem using slight changes, Thanks