redirecting HTTPS requests to http in lighttpd

Posted by chochim on Server Fault See other posts from Server Fault or by chochim
Published on 2012-11-20T07:09:18Z Indexed on 2012/11/20 11:07 UTC
Read the original article Hit count: 185

Filed under:

I have a lighttpd server running which has an SSL certificate installed. I would, due to certain reasons, like to forward all https: //www. requests to http: //www.

My lighttpd code looks like as follows:

$SERVER["socket"] == ":443"
{
   ssl.engine = "enable"
   ssl.pemfile = "/path/to/pem/file"
   ssl.ca-file = "/path/to/ca/file"
   HTTP["host"] =~ "^www\.(.*)$" {
       url.redirect = ("^/(.*)" => "http://www.%1$1")
   }
}

Can you please point out the problem here. Another thing, what is the difference between %1 and $1 ?

© Server Fault or respective owner

Related posts about lighttpd