Skip to content

Commit

Permalink
feat(nginx): allow blocking certain user-agents on production
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewKostka committed Oct 30, 2023
1 parent 5bf9dc6 commit 5b79002
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions k8s/helmfile/env/production/platform-nginx.nginx.conf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ map $request_uri $mwgroup {
default "web";
}

map $http_user_agent $blocked_agent {
~Bytespider 1;
default 0;
}

server {
listen 8080;
server_name _; # This is just an invalid value which will never trigger on a real hostname.
Expand Down Expand Up @@ -65,6 +70,10 @@ server {

proxy_max_temp_file_size 1024m;

if ($blocked_agent) {
return 444;
}

# Allowoverriding the group decision using the magic header
if ($http_x_wbstack_alpha) {
set $mwgroup "alpha";
Expand Down

0 comments on commit 5b79002

Please sign in to comment.