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
This commit is contained in:
Jacob Salmela 2015-10-17 12:11:03 -05:00
parent 28dd956449
commit 7b16a42f31
1 changed files with 15 additions and 7 deletions

View File

@ -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" )
}