Created
January 2, 2014 03:10
-
-
Save luishdez/8214477 to your computer and use it in GitHub Desktop.
Varnish hotlinking protection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sub hot_link { | |
if ( | |
( | |
req.http.host == "http://www.videoszoofilia.org" || | |
req.http.host == "http://videoszoofilia.org") && | |
req.url ~ "\.(js|css|jpg|jpeg|png|gif)$" && | |
(req.http.referer && | |
(req.http.referer !~ "^http://www.videoszoofilia.org/" && req.http.referer !~ "^http://videoszoofilia.org/")) | |
) { | |
error 403 "No more hot linking"; | |
} | |
} | |
sub vcl_recv { | |
call hot_link; | |
... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment