Sfoglia il codice sorgente

Truncate IP addresses

master
Chris Smith 5 anni fa
parent
commit
8b7edfb54f
1 ha cambiato i file con 7 aggiunte e 1 eliminazioni
  1. 7
    1
      nginx.conf

+ 7
- 1
nginx.conf Vedi File

@@ -14,9 +14,15 @@ http {
14 14
     include       /etc/nginx/mime.types;
15 15
     default_type  application/octet-stream;
16 16
 
17
+    map $http_x_forwarded_for $forwarded_anon {
18
+        ~(?P<ip>\d+\.\d+\.\d+)\.    $ip.0;
19
+        ~(?P<ip>[^:]+:[^:]+):       $ip::;
20
+        default                     0.0.0.0;
21
+    }
22
+
17 23
     log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
18 24
                       '$status $body_bytes_sent "$http_referer" '
19
-                      '"$http_user_agent" "$http_x_forwarded_for"';
25
+                      '"$http_user_agent" "$forwarded_anon"';
20 26
 
21 27
     access_log  /logs/access.log  main;
22 28
 

Loading…
Annulla
Salva