Hotlink protection - How to?

Can anyone covert this NGINX code into Caddy for hotlink protection, please?

location ~ .(gif|png|jpeg|jpg|svg)$ {
     valid_referers none blocked ~.google. ~.bing. ~.yahoo. yourdomain.com *.yourdomain.com;
     if ($invalid_referer) {
        return   403;
    }
}

The valid_referers nginx directive checks the value of the Referer header. Look into the header_regexp matcher to implement the same behavior.

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.