I
I
Igor Petrov2017-03-09 16:17:48
Nginx
Igor Petrov, 2017-03-09 16:17:48

How to block header in nginx?

Good day!
There was such a need to block certain headers in nginx, namely when dumping, we can see f2a2c06dcfbd4290bdf0de265032f619.png
How to block all headers in NGINX that have a SQUID server?
I will be very grateful for your help

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sim3x, 2017-03-09
@daniks

https://www.cyberciti.biz/faq/unix-linux-appleosx-...

### case sensitive http user agent blocking  ###
if ($http_user_agent ~ (Catall Spider|AcoiRobot) ) {
    return 403;
}
### case insensitive http user agent blocking  ###
if ($http_user_agent ~* (foo|bar) ) {
    return 403;
}

mailman.nginx.org/pipermail/nginx/2007-January/000...
stackoverflow.com/questions/18970620/nginx-reject-...
map $http_via $is_not_ok {
    default     "0";
    "~*squid"  "1";
}

if ($is_not_ok) {
    return 405; 
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question