I tried to reconfigured my lighttpd to automatically relocate any HTTP requests to HTTPS requests. To do this, I found the following config snipped in the Lighttpd Redmine Wiki:
$HTTP["scheme"] == "http" { url.redirect = ("" => "https://${url.authority}${url.path}${qsa}") } However, lighttpd does not seem to replace the placeholders. Here is a sample HTTP-Request/Response via telnet (I replaced my Hostname with 'example.org', all the rest is original):
# telnet localhost 80 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. GET / HTTP/1.0 Host: example.org HTTP/1.0 301 Moved Permanently Location: https://${url.authority}${url.path}${qsa} Content-Length: 0 Connection: close Date: Fri, 11 Sep 2020 12:43:32 GMT Server: lighttpd/1.4.45 Connection closed by foreign host. Instead of Location: https://${url.authority}${url.path}${qsa} the line should be Location: https://example.org/.
What's wrong with it? Did I forget to load a module?
Any ideas?
Some parts of my lighttpd.conf:
Since the loading order of modules seems to be important. Here is my current config for that:
server.modules = ( "mod_expire", "mod_access", "mod_alias", "mod_compress", "mod_redirect", "mod_rewrite", "mod_setenv" ) # cat /etc/debian_version 9.13 Lighttpd seems to be happy with the configuration file (there is no output for -t or -tt):
# lighttpd -tt -v -f /etc/lighttpd/lighttpd.conf lighttpd/1.4.45 (ssl) - a light and fast webserver Build-Date: Jan 14 2017 21:07:19 #