Nginx Valid Referer - Access Control - Help Wanted

lists lists at lazygranch.com
Fri Feb 7 12:09:38 UTC 2020


If you are going to block one thing, eventually you will block two, then three, etc. 

I suggest learning how to use "map". 

https://www.edmondscommerce.co.uk/handbook/Servers/Config/Nginx/Blocking-URLs-in-batch-using-nginx-map/







  Original Message  


From: nginx-forum at forum.nginx.org
Sent: February 6, 2020 3:03 PM
To: nginx at nginx.org
Reply-to: nginx at nginx.org
Subject: Re: Nginx Valid Referer - Access Control - Help Wanted


J.R. Wrote:
-------------------------------------------------------
> > 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"...
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx

I deleted the 'none' and 'blocked' and no difference still not blocking
direct access to the URL

Tried adding it in its own block and adding it to the end of an existing
block neither worked

Is the location /radio/ part ok

I am trying to block direct access to any URL with a directory /radio/

The URLs look like sub.domain.tld/radio/1234/mytrack.mp3?45678901

I need it so the URL is only served if a link on *.mysite.* is clicked ie
the track is only played through an html5 audio player on mysite

Anyone have anymore ideas

Best regards

Ashley

Posted at Nginx Forum: https://forum.nginx.org/read.php?2,286958,286965#msg-286965

_______________________________________________
nginx mailing list
nginx at nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx


More information about the nginx mailing list