0

I have the following code on nginx to prevent hotlink

location ~ ^/(.*\.(jpe?g|png|gif))$ {
    valid_referers none blocked domain1.ext *.domain2.ext *.domain3.ext;
    if ($invalid_referer) {
        return 403;
    }
}

domain1 and domain2 are mine so no issue. Domain 3 is not mine and I need allow refer only from a specific page. I mean I don't wanna allow the full domain3.ext but only a specific page who is: status.domain3.ext/codepage-100

Can I edit the code above to replace domain3.ext with status.domain3.ext/codepage-100?

I tried:

location ~ ^/(.*\.(jpe?g|png|gif))$ {
    valid_referers none blocked domain1.ext *.domain2.ext status.domain3.ext/codepage-100;
    if ($invalid_referer) {
        return 403;
    }
}

but is not working.

Marco
  • 1

0 Answers0