Nginx Valid Referer - Access Control - Help Wanted

J.R. themadbeaker at gmail.com
Wed Feb 5 21:40:16 UTC 2020


> I found various code examples to add to the conf file and coupled this
> together and added it to the end of the conf file, but it doesn't work,
> entering a URL directly into the browser serves it

> server {
>    location /radio/ {
>        valid_referers none blocked server_names ~\.mysite\.;
>        if ($invalid_referer) { return 403; }
>    }
> }

If you enter a URL directly into your browser, there will be no
referrer. You have "none" set as a valid value, thus that is why it is
working...

If you only want to accept requests with your server's name in the
referrer field, remove "none" & "blocked"...


More information about the nginx mailing list