How do I redirect all http request to https?
Added by mrjayviper almost 11 years ago
Hello.
I'm trying to use lighttpd as a HTTPS frontend to a non-secure website that is on my home network.
it's like this: web <=> router (port properly forwarded) <=> lighttpd via https <=> my non-secure website.
But it's not working. I get the lighttpd login prompt but when I get passed that step, the URL in the browser changes to http. I am very sure the URL that I type is using HTTPS.
any ideas what could I be doing wrong?
Thanks a lot
here's a snippet of my conf file. The realm "PWebInterface" is the one I am trying to fix. "ZWebInterface" works as is. It doesn't require additional configuration. I only added the part "redirect https to http" for "PWebInterface".
#redirect all request to https $HTTP["scheme"] == "http" { $HTTP["host"] =~ ".*" { url.redirect = (".*" => "https://%0$0") } } $SERVER["socket"] == ":6666" { ssl.engine = "enable" ssl.pemfile = "/usr/local/etc/lighttpd/lighttpd.pem" $HTTP["url"] =~ "" { auth.require = ( "" => ( "method" => "digest", "realm" => "PWebInterface", "require" => "valid-user" ) ) proxy.debug = 1 proxy.server = ( "" => ( ( "host" => "127.0.0.1", "port" => 6665 ) ) ) } } $SERVER["socket"] == ":9999" { ssl.engine = "enable" ssl.pemfile = "/usr/local/etc/lighttpd/lighttpd.pem" $HTTP["url"] =~ "^/transmission*" { auth.require = ( "" => ( "method" => "digest", "realm" => "ZWebInterface", "require" => "valid-user" ) ) proxy.debug = 1 proxy.server = ( "" => ( ( "host" => "127.0.0.1", "port" => 9998 ) ) ) }