Correctly set up hotlink protection for images (solved)


#1

I am trying to set up hotlink protection for images with the following (inside my /etc/nginx/site-available/example.com server block) but it does not appear to be working correctly:

        location ~* \.(svg|svgz|jpg|jpeg|gif|png|ico|bmp)$ {
            valid_referers blocked example.com .feedburner.com;
            if ($invalid_referer) {
            return 403;
    }
}

(My code is similar to that found here: https://github.com/EasyEngine/easyengine/issues/55 )

(1) I’ve restarted nginx after changes with no errors. (2) I’ve purged the cache. (3) I use cloudflare but cannot find any obvious conflicts.

Have I done anything obviously wrong here?


#2

As I suspected, my problem is that the location block is already specified elsewhere. See here for solution: https://github.com/EasyEngine/easyengine/issues/55#issuecomment-180783400


#3