Lighttpd/1.4.53 (ssl) returns [ERROR]: Unable to parse results from queryads.php: Unhandled error message ( )

Hi folks,

after updating to Pi-hole Version v4.4 (Web Interface Version v4.3.3 FTL Version v4.3.1) lighttpd shows some strange behavior I'd like to ask you if you spot my failure at a single glance.

I do have a different document-root for URL's suffix /doctora that lighttpd answers with the appended screenshot


when requested from intranet or with the message "[ERROR]: Unable to parse results from queryads.php: Unhandled error message ( )" when requested from internet.

I appended lighttpd.conf (loading mod_alias) and external.conf (declaring an alias) that contains the redirect for /doctora to /home/pi/doctora/doctora

Can anybody tell me why this redirect is resolved to some error-message?

Many thanks in advance

Christian

lighttpd.conf

# Pi-hole: A black hole for Internet advertisements
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your own hardware.
#
# Lighttpd config for Pi-hole
#
# This file is copyright under the latest version of the EUPL.
# Please see LICENSE file for your rights under this license.

###############################################################################
#     FILE AUTOMATICALLY OVERWRITTEN BY PI-HOLE INSTALL/UPDATE PROCEDURE.     #
# ANY CHANGES MADE TO THIS FILE AFTER INSTALL WILL BE LOST ON THE NEXT UPDATE #
#                                                                             #
#              CHANGES SHOULD BE MADE IN A SEPARATE CONFIG FILE:              #
#                         /etc/lighttpd/external.conf                         #
###############################################################################

server.modules = (
	"mod_access",
	"mod_accesslog",
	"mod_alias",
	"mod_auth",
	"mod_expire",
	"mod_compress",
	"mod_redirect",
	"mod_setenv",
	"mod_rewrite"
)

server.document-root        = "/var/www/html"
server.error-handler-404    = "/pihole/index.php"
server.upload-dirs          = ( "/var/cache/lighttpd/uploads" )
server.errorlog             = "/var/log/lighttpd/error.log"
server.pid-file             = "/var/run/lighttpd.pid"
server.username             = "www-data"
server.groupname            = "www-data"
server.port                 = 80
accesslog.filename          = "/var/log/lighttpd/access.log"
# https://doc.lighttpd.net/lighttpd2/mod_accesslog.html
accesslog.format            = "%h %V %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\""

index-file.names            = ( "index.php", "index.html", "index.lighttpd.html" )
url.access-deny             = ( "~", ".inc", ".md", ".yml", ".ini" )
static-file.exclude-extensions = ( ".php", ".pl", ".fcgi" )

compress.cache-dir          = "/var/cache/lighttpd/compress/"
compress.filetype           = ( "application/javascript", "text/css", "text/html", "text/plain" )

mimetype.assign   = ( ".png"  => "image/png",
                      ".jpg"  => "image/jpeg",
                      ".jpeg" => "image/jpeg",
                      ".html" => "text/html",
                      ".css" => "text/css; charset=utf-8",
                      ".js" => "application/javascript",
                      ".json" => "application/json",
                      ".txt"  => "text/plain",
                      ".svg"  => "image/svg+xml" )

# default listening port for IPv6 falls back to the IPv4 port
include_shell "/usr/share/lighttpd/use-ipv6.pl " + server.port

# Prevent Lighttpd from enabling Let's Encrypt SSL for every blocked domain
#include_shell "/usr/share/lighttpd/include-conf-enabled.pl"
include_shell "find /etc/lighttpd/conf-enabled -name '*.conf' -a ! -name 'letsencrypt.conf' -printf 'include \"%p\"\n' 2>/dev/null"

# 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!",
        "X-Frame-Options" => "DENY"
    )

    $HTTP["url"] =~ ".ttf$" {
        # Allow Block Page access to local fonts
        setenv.add-response-header = ( "Access-Control-Allow-Origin" => "*" )
    }
}

# Block . files from being served, such as .git, .github, .gitignore
$HTTP["url"] =~ "^/admin/\.(.*)" {
     url.access-deny = ("")
}

# Add user chosen options held in external file
# This uses include_shell instead of an include wildcard for compatibility
include_shell "cat external.conf 2>/dev/null"

external.conf

$HTTP["remoteip"] !~ "192.168.178.10|192.168.178.20" {
    $HTTP["url"] =~ "^/admin/" {
      url.access-deny = ( "" )
    }
}

$HTTP["url"] =~ "^/kattenwinkel($|/)" {
    dir-listing.activate = "enable" 
}

alias.url += ( "/doctora" => "/home/pi/doctora/doctora" )

access.log

192.168.178.20 192.168.178.30 - [04/Mar/2020:14:31:09 +0100] "GET / HTTP/1.1" 200 3767 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0"
192.168.178.20 192.168.178.30 - [04/Mar/2020:14:31:10 +0100] "GET /Connectivity.css HTTP/1.1" 304 0 "http://192.168.178.30/" "Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0"
192.168.178.20 192.168.178.30 - [04/Mar/2020:14:32:20 +0100] "GET / HTTP/1.1" 304 0 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0"
192.168.178.20 192.168.178.30 - [04/Mar/2020:14:32:20 +0100] "GET /Connectivity.css HTTP/1.1" 304 0 "http://192.168.178.30/" "Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0"
192.168.178.20 192.168.178.30 - [04/Mar/2020:14:32:47 +0100] "GET /kattenwinkel/ HTTP/1.1" 200 6963 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0"
192.168.178.20 192.168.178.30 - [04/Mar/2020:14:33:09 +0100] "GET /doctora/ HTTP/1.1" 200 405 "-" "Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0"
192.168.178.20 192.168.178.30 - [04/Mar/2020:14:33:09 +0100] "GET /pihole/blockingpage.css HTTP/1.1" 304 0 "http://192.168.178.30/doctora/" "Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0"
192.168.178.20 192.168.178.30 - [04/Mar/2020:14:33:09 +0100] "GET /admin/img/logo.svg HTTP/1.1" 304 0 "http://192.168.178.30/doctora/" "Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Firefox/68.0"

Either /doctora or /home/pi/doctora/doctora is 404. I'd give /home/pi/doctora/doctora/ a try since you're redirecting to a directory and not to a file.

OK, thanks. An ending slash http://192.168.178.30/doctora/ does not do the trick.
How telling lighttpd to perform that forward correct? It (this very external.conf) forwarded perfectly till update ...

Did you edit the configuration file to replace /home/pi/doctora/doctora with /home/pi/doctora/doctora/ ?

Nor does this help. I put a tailing slash in alias.url += ( "/doctora" => "/home/pi/doctora/doctora/" ) and restartet lighttpd - without any improvement :frowning:

Does the lighttpd error.log show anything?

I thought about filesystem-issues and checked but error.log doesn't provide any help! It looks like this:

2020-03-01 00:00:13: (server.c.1759) logfiles cycled UID = 0 PID = 29962 
2020-03-01 09:50:59: (mod_fastcgi.c.421) FastCGI-stderr: PHP Notice:  Undefined index: HTTP_HOST in /var/www/html/pihole/index.php on line 10
2020-03-02 11:38:10: (mod_fastcgi.c.421) FastCGI-stderr: PHP Notice:  Undefined index: HTTP_HOST in /var/www/html/pihole/index.php on line 10
2020-03-03 02:58:59: (request.c.785) request-URI parse error -> 400 for: ip.ws.126.net:443 
2020-03-03 09:27:16: (mod_fastcgi.c.421) FastCGI-stderr: PHP Notice:  Undefined index: HTTP_HOST in /var/www/html/pihole/index.php on line 10
2020-03-03 21:37:56: (mod_fastcgi.c.421) FastCGI-stderr: PHP Notice:  Undefined index: HTTP_HOST in /var/www/html/pihole/index.php on line 10
2020-03-03 23:20:09: (request.c.785) request-URI parse error -> 400 for: ip.ws.126.net:443 
2020-03-04 10:07:56: (server.c.2059) server stopped by UID = 0 PID = 1 
2020-03-04 10:07:57: (server.c.1464) server started (lighttpd/1.4.53) 
2020-03-04 10:07:57: (server.c.1493) WARNING: unknown config-key: alias.url (ignored) 
2020-03-04 10:19:08: (server.c.2059) server stopped by UID = 0 PID = 1 
2020-03-04 10:19:09: (server.c.1464) server started (lighttpd/1.4.53) 
2020-03-04 10:19:09: (server.c.1493) WARNING: unknown config-key: alias.url (ignored) 
2020-03-04 10:28:37: (server.c.2059) server stopped by UID = 0 PID = 1 
2020-03-04 10:28:37: (server.c.1464) server started (lighttpd/1.4.53) 
2020-03-04 10:34:44: (server.c.2059) server stopped by UID = 0 PID = 1 
2020-03-04 10:34:45: (server.c.1464) server started (lighttpd/1.4.53) 
2020-03-04 10:41:40: (server.c.2059) server stopped by UID = 0 PID = 1 
2020-03-04 10:41:40: (server.c.1464) server started (lighttpd/1.4.53) 
2020-03-04 10:53:16: (server.c.2059) server stopped by UID = 0 PID = 1 
2020-03-04 10:53:17: (server.c.1464) server started (lighttpd/1.4.53) 
2020-03-04 10:59:30: (server.c.2059) server stopped by UID = 0 PID = 1 
2020-03-04 10:59:31: (server.c.1464) server started (lighttpd/1.4.53) 
2020-03-04 18:13:35: (server.c.2059) server stopped by UID = 0 PID = 1 
2020-03-04 18:13:36: (server.c.1464) server started (lighttpd/1.4.53)
´´´

Revert any changes to that file, and heed the header instructing to not make changes there.

server.modules += ("mod_alias")

And then check (tail) the access.log to see what is served when you go to the URLs in your browser.

OK, back to basic.
The access.log now looks like this:

1583352733|192.168.178.30|GET / HTTP/1.1|200|3770
1583352734|192.168.178.30|GET /Connectivity.css HTTP/1.1|200|208
1583352734|192.168.178.30|GET /favicon.ico HTTP/1.1|200|19488
1583352737|192.168.178.30|GET /kattenwinkel/ HTTP/1.1|200|6963
1583352737|192.168.178.30|GET /favicon.ico HTTP/1.1|200|19488
1583352739|192.168.178.30|GET /doctora/ HTTP/1.1|200|405
1583352739|192.168.178.30|GET /pihole/blockingpage.css HTTP/1.1|200|4127
1583352739|192.168.178.30|GET /admin/img/logo.svg HTTP/1.1|200|1649
´´´
but this still tells me nothing about what file `lighttps` tries to load and send.

What does curl -I http://localhost/doctora/ show on the Pi-hole device command line?

Edit and then follow that with curl -IL http://localhost/doctora/

Strange!

curl -I http://localhost/doctora/
HTTP/1.1 200 OK
Content-type: text/html; charset=UTF-8
Date: Wed, 04 Mar 2020 20:18:27 GMT
Server: lighttpd/1.4.53
´´´

I was expecting some error here!

Does the curl without a trailing / show a redirect?

Even stranger!

curl -IL http://localhost/doctora
HTTP/1.1 301 Moved Permanently
Location: http://localhost/doctora/
Date: Wed, 04 Mar 2020 20:20:21 GMT
Server: lighttpd/1.4.53

HTTP/1.1 200 OK
Content-type: text/html; charset=UTF-8
Date: Wed, 04 Mar 2020 20:20:21 GMT
Server: lighttpd/1.4.53
´´´

That's kind of telling me that /doctora/ is serving up /pihole/blockingpage.css

Normally blockingpage is served via 404.

access.log looks fine:

127.0.0.1 127.0.0.1 - [04/Mar/2020:21:18:27 +0100] "GET /admin/scripts/pi-hole/php/queryads.php?domain=localhost&bp HTTP/1.0" 200 405 "-" "-"
::1 localhost - [04/Mar/2020:21:18:27 +0100] "HEAD /doctora/ HTTP/1.1" 200 0 "-" "curl/7.64.0"
127.0.0.1 127.0.0.1 - [04/Mar/2020:21:20:01 +0100] "GET /admin/scripts/pi-hole/php/queryads.php?domain=localhost&bp HTTP/1.0" 200 405 "-" "-"
::1 localhost - [04/Mar/2020:21:20:01 +0100] "HEAD /doctora/ HTTP/1.1" 200 0 "-" "curl/7.64.0"
::1 localhost - [04/Mar/2020:21:20:21 +0100] "HEAD /doctora HTTP/1.1" 301 0 "-" "curl/7.64.0"
127.0.0.1 127.0.0.1 - [04/Mar/2020:21:20:21 +0100] "GET /admin/scripts/pi-hole/php/queryads.php?domain=localhost&bp HTTP/1.0" 200 405 "-" "-"
::1 localhost - [04/Mar/2020:21:20:21 +0100] "HEAD /doctora/ HTTP/1.1" 200 0 "-" "curl/7.64.0"
´´´

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.