From e2997b81352e9a68a46187c109df7c7f5360ad93 Mon Sep 17 00:00:00 2001 From: Eric Warnke Date: Tue, 25 Oct 2016 14:46:26 -0400 Subject: [PATCH 1/2] Due to lighttpd bug 2526 the url.rewrite for javascript must be placed outside of the $HTTP block or it will never evaluate. --- advanced/lighttpd.conf.debian | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/advanced/lighttpd.conf.debian b/advanced/lighttpd.conf.debian index 8b62f448..bf2e5104 100644 --- a/advanced/lighttpd.conf.debian +++ b/advanced/lighttpd.conf.debian @@ -52,10 +52,11 @@ $HTTP["url"] =~ "^/admin/" { ) } +# Rewite js requests, must be out of $HTTP block due to bug #2526 +url.rewrite = ( "^(?!/admin/).*\.js$" => "pihole/index.js" ) + # If the URL does not start with /admin, then it is a query for an ad domain $HTTP["url"] =~ "^(?!/admin)/.*" { # Create a response header for debugging using curl -I setenv.add-response-header = ( "X-Pi-hole" => "A black hole for Internet advertisements." ) - # rewrite only js requests - url.rewrite = ("(.*).js" => "pihole/index.js") } From f1c1caf7bdac56e4ae22d600cad9f5e70bbeac80 Mon Sep 17 00:00:00 2001 From: Eric Warnke Date: Tue, 25 Oct 2016 14:48:32 -0400 Subject: [PATCH 2/2] url.rewrite does not work in $HTTP block lighttpd bug #2526 --- advanced/lighttpd.conf.fedora | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/advanced/lighttpd.conf.fedora b/advanced/lighttpd.conf.fedora index 8b8e0692..fc00923c 100644 --- a/advanced/lighttpd.conf.fedora +++ b/advanced/lighttpd.conf.fedora @@ -69,10 +69,11 @@ $HTTP["url"] =~ "^/admin/" { setenv.add-response-header = ( "X-Pi-hole" => "The Pi-hole Web interface is working!" ) } +# Rewite js requests, must be out of $HTTP block due to bug #2526 +url.rewrite = ( "^(?!/admin/).*\.js$" => "pihole/index.js" ) + # If the URL does not start with /admin, then it is a query for an ad domain $HTTP["url"] =~ "^(?!/admin)/.*" { # Create a response header for debugging using curl -I setenv.add-response-header = ( "X-Pi-hole" => "A black hole for Internet advertisements." ) - # rewrite only js requests - url.rewrite = ("(.*).js" => "pihole/index.js") }