@@ -12,11 +12,11 @@ events {
1212pid /usr/local/etc/adblock2privoxy/nginx-adblock2privoxy.pid;
1313
1414# error_log /opt/local/var/log/nginx/error-adblock2privoxy.log warn;
15- error_log /dev/null ;
15+ error_log stderr warn ;
1616
1717http {
1818 # access_log /opt/local/var/log/nginx/access-adblock2privoxy.log;
19- access_log /dev/null ;
19+ access_log /dev/stdout ;
2020
2121 # Increase client_max_body_size to handle larger requests, uncommented for clarity
2222 client_max_body_size 64M;
@@ -53,14 +53,9 @@ http {
5353 #root = --webDir parameter value
5454 root /usr/local/etc/adblock2privoxy/css;
5555
56- # If useHTTP is set:
57- # Ensure that http://localhost:8119/ is a legitimate (200 return code)
58- # default page; use as iOS proxy.pac blackhole
59- # Test with curl -I --proxy http://127.0.0.1:8119 http://www.foo.com/bar?q=snafoo
60- location / {
61- return 301 http://$server_name:$server_port/@blackhole?;
62- # rewrite ^ /default.html break;
63- }
56+ # ────────────────────────────────────────────────
57+ # Blackhole
58+ # ────────────────────────────────────────────────
6459
6560 location ~ ^/@blackhole {
6661 default_type text/html;
@@ -69,29 +64,41 @@ http {
6964 # rewrite ^ /default.html break;
7065 }
7166
67+ # ────────────────────────────────────────────────
68+ # ab2p resources
69+ # ────────────────────────────────────────────────
70+
7271 location ~ ^/+(ab2p(?:\.common)?\.css) {
7372 # ab2p.css in top-level directory
7473 default_type text/css;
75- add_header X-Content-Type-Options nosniff;
76- add_header Cache-Control "public, max-age=31536000, immutable";
77- try_files $uri $1;
74+ add_header X-Content-Type-Options nosniff always ;
75+ add_header Cache-Control "public, max-age=31536000, immutable" always ;
76+ try_files $uri $1 =404 ;
7877 }
7978
8079 location ~ ^/[^/.]+\..+/ab2p\.css$ {
8180 # first reverse domain names order
8281 default_type text/css;
83- add_header X-Content-Type-Options nosniff;
84- add_header Cache-Control "public, max-age=31536000, immutable";
82+ add_header X-Content-Type-Options nosniff always ;
83+ add_header Cache-Control "public, max-age=31536000, immutable" always ;
8584 rewrite ^/([^/]*?)\.([^/.]+)(?:\.([^/.]+))?(?:\.([^/.]+))?(?:\.([^/.]+))?(?:\.([^/.]+))?(?:\.([^/.]+))?(?:\.([^/.]+))?(?:\.([^/.]+))?/ab2p.css$ /$9/$8/$7/$6/$5/$4/$3/$2/$1/ab2p.css last;
8685 }
8786
8887 location ~ (^.*/+)[^/]+/+ab2p\.css {
8988 # then try to get CSS for current domain
9089 # if it is unavailable - get CSS for parent domain
9190 default_type text/css;
92- add_header X-Content-Type-Options nosniff;
93- add_header Cache-Control "public, max-age=31536000, immutable";
94- try_files $uri $1ab2p.css;
91+ add_header X-Content-Type-Options nosniff always;
92+ add_header Cache-Control "public, max-age=31536000, immutable" always;
93+ try_files $uri $1ab2p.css =404;
94+ }
95+
96+ # ────────────────────────────────────────────────
97+ # Fallback
98+ # ────────────────────────────────────────────────
99+
100+ location / {
101+ return 204;
95102 }
96103 }
97104}
0 commit comments