Avoiding Hotlinking
Basic protection against hotlinking
sub vcl_recv {
if (req.http.host == "www.example.com") {
if(req.url ~ "^/wiki/contenido" && urlplus.get_extension() ~ "^(jpg|jpeg|png|gif|svg|mp4)$") {
set req.http.TCDN-Avoid-Hotlink-URL = "/img/hotlink-placeholder.png";
}
}
}sub vcl_recv {
if (req.http.host == "www.example.com") {
if(
req.url ~ "^/wiki/contenido" &&
urlplus.get_extension() ~ "^(jpg|jpeg|png|gif|svg|mp4)$" &&
req.http.referer !~ "^https?://www.example2.com"
) {
set req.http.TCDN-Avoid-Hotlink-URL = "/img/hotlink-placeholder.png";
}
}
}cLast updated
Was this helpful?
