conditionals for accessing the web interface

This adds in some back end improvements for better debugging.  It also
allows you to access the Web interface, while you are connected to the
Pi-hole, which resolves #31
pull/62/head
Jacob Salmela 9 years ago
parent 28dd956449
commit 7b16a42f31

@ -2,6 +2,7 @@ server.modules = (
"mod_expire",
"mod_compress",
"mod_redirect",
"mod_setenv",
"mod_rewrite"
)
@ -26,13 +27,20 @@ include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port
include_shell "/usr/share/lighttpd/create-mime.assign.pl"
include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
# Set access to 1 day for better query performance when the list gets so large
# http://jacobsalmela.com/raspberry-pi-block-ads-adtrap/#comment-2013820434
$HTTP["url"] =~ "^/pihole/" {
expire.url = ("" => "access plus 1 days")
# If the URL starts with /admin, it is the Web interface
$HTTP["url"] =~ "^/admin/" {
# Create a response header for debugging using curl -I
setenv.add-response-header = ( "X-Pi-hole" => "The Pi-hole Web interface is working!" )
}
# Rewrites all URLs to the /var/www/pihole/index.html
$HTTP["host"] =~ ".*" {
url.rewrite = (".*" => "pihole/index.html")
# 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." )
# Set the cache to 1 day for better performance
expire.url = ("" => "access plus 1 days")
# Send the query into the black hole
url.rewrite = (".*" => "pihole/index.html" )
}

Loading…
Cancel
Save