Skip to content

Commit 247986f

Browse files
block certain requests for no referer (#10773)
* block certain requests for no referer --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 06cf705 commit 247986f

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

docker/web_nginx.conf

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,31 @@ server {
8989
return 444;
9090
}
9191

92+
93+
# ===========================================
94+
# Block certain patterns when no referer set:
95+
# ===========================================
96+
97+
# Create a variable to track if referer is empty
98+
set $suspect_arg 0;
99+
100+
# If any of the following parameters are set...
101+
if ($args ~* "(v=|m=|action=)") {
102+
set $suspect_arg 1;
103+
}
104+
105+
# AND if the referer is set...
106+
if ($http_referer = "" ) {
107+
set $suspect_arg "${suspect_arg}1";
108+
}
109+
110+
# Block requests with m= v= or action= parameters and empty referer
111+
if ($suspect_arg = "11") {
112+
return 444;
113+
}
114+
115+
# -------------------------------------------
116+
92117
proxy_pass http://webnodes;
93118
proxy_set_header Host $http_host;
94119

0 commit comments

Comments
 (0)