1
0
Эх сурвалжийг харах

template: added Hotlink Protection #30

0xJacky 2 жил өмнө
parent
commit
9ba9711568

+ 23 - 0
template/block/hotlink-protection.conf

@@ -0,0 +1,23 @@
+# Nginx UI Template Start
+name = "Hotlink Protection"
+author = "@0xJacky"
+description = { en = "Hotlink Protection Config Template", zh_CN = "防盗链配置模板"}
+
+[variables.NoneReferer]
+type = "boolean"
+name = { en = "Allow Referer is None", zh_CN = "允许空 Referer"}
+value = false
+
+[variables.AllowReferers]
+type = "string"
+name = { en = "Allow Referers", zh_CN = "允许的 Referers"}
+value = ""
+# Nginx UI Template End
+
+
+location ~ .*\.(jpg|png|js|css)$ {
+    valid_referers {{- if .NoneReferer}} none {{- end}} blocked server_names {{if .AllowReferers}}{{.AllowReferers}}{{- end}};
+    if ($invalid_referer) {
+        return 403;
+    }
+}