0

how to block direct link?

I have files subtitles want to block direct link and access. But this referrer block access to my domain too

location ~\.(vtt|srt|txt)$ {
    allow localhost;
    deny all;
    return 404;
}

location ~ \.vtt {
    try_files $uri /index.php =404;
    fastcgi_split_path_info ^(.+\.vtt)(/.+)$;
    fastcgi_pass 127.0.0.1:9000;
    fastcgi_index index.php;
}

Thanks

  • So you would like access to be granted when the referrer is one of your own pages, and denied otherwise? – joanis May 24 '23 at 04:57
  • Possibly related? https://stackoverflow.com/questions/43447490/how-to-set-referrer-policy-with-nginx – joanis May 24 '23 at 04:58
  • @joanis yes, but when I server block directory images, still can display but not for files subtitle .vtt – Stevan Mars Jun 13 '23 at 09:39

0 Answers0