B
B
bernex2014-07-18 05:04:37
Nginx
bernex, 2014-07-18 05:04:37

How to set up NGINX for referrer protection?

I want people to not be able to make hotlinks (integrate my js, css to their sites), only for my domain.
It would also be impossible to go through an empty referrer and open the code for viewing through a browser (js, css), but it was executed.
What to do with search engines, do they need them? How to take them into account?
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
evnuh, 2014-07-18
@evnuh

Ask yourself - why? Who needs it, that code will look anyway. And does anyone really need your scripts and pictures?
And for your question - go to Google, there are a bunch of questions on StackOverflow for any relevant query.

location ~ ^/([a-zA-Z0-9\.\-]*)/(.*) {
    if ($http_referer !~ "^$1.*$"){
            return 403;
    }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question