Friday, March 21, 2014

Lighttpd: full site with SSL with exception of a url / path / directory

Well.. perhaps you need SSL in your site but you want to exclude a concrete path / url. This is my config:


# When http then https but no redirect for "knowledgebase" path
$HTTP["scheme"] == "http" {
$HTTP["host"] =~ "secure.site.com" {
url.redirect = ( "^/(?!(knowledgebase).*)" => "https://secure.site.com/$1" )
server.document-root = "/site/secure"
}
}
#behavior for SSL
$HTTP["scheme"] == "https" {
$HTTP["host"] =~ "^secure\.site\.com" {
ssl.engine = "enable"
server.document-root = "/site/secure"
server.max-keep-alive-idle = 3
}
#if "knowledgebase" is accessed from inside of the SSL site then exit to http!
$HTTP["url"] =~ "knowledgebase" {
setenv.add-environment = ( "HTTPS" => "off" )
ssl.engine = "disable"
url.redirect = ( "^/(.*)" => "http://secure.site.com/$1" )
}
}
view raw gistfile1.txt hosted with ❤ by GitHub

1 comment: