redirect :8443 from http to https
Added by pbhj almost 16 years ago
I'm trying to solve an issue my web host (reseller) has from an upgrade to Plesk, their Plesk 9.2 is served as sw-cp-server 1.0 from a Linux host (Centos 5.3 I believe) - I don't know what version of lighttpd this corresponds to however.
My clients have instructions to connect to, eg http://example.org:8443 to get to Plesk. This used to redirect to https://example.org:8443/ courtesy of Apache's server. However Plesk 9.2 requires lighttpd which my host reports can't do this redirect. I've looked at the forums here and the Issues, particularly http://redmine.lighttpd.net/wiki/lighttpd/HowToRedirectHttpToHttps, and it seems that:
$SERVER["socket"] == ":8443" {
$HTTP["host"] =~ "(.*)" {
url.redirect = ( "^/(.*)" => "https://%1/$1" )
}
}
Might do the trick (which file does this go in?). Though a thread at http://forum.lighttpd.net/topic/897 suggests this may create a recursive redirect. Ideally we'd be able to do something like:
$SERVER["socket"] == ":8443" {
$HTTP["script_uri"] =~ "http\:\/\/.*" {
url.redirect = ( "^/(.*)" => "https://%1/$1" )
}
}
But if the variable script_uri isn't exposed here then I thought perhaps something along the lines of:
$SERVER["socket"] == ":8443" {
$HTTP["host"] =~ "(.*)" {
url.redirect = ( "^/$" => "https://%1/login.php3" )
}
}
would solve the recursion?
Any help happily received. Even a RTFM and a pointer to the right part of the manual. Like I said this isn't my server and I'm not at all familiar with lighttpd (though do have experience with configuring Apache's httpd).
If it's not possible to do the above redirect then I'd consider a redirect from http://example.org:8443 to http://example.org:8880 as a poor alternative.
Replies (1)
RE: redirect :8443 from http to https - Added by Albright almost 16 years ago
Perhaps try something like this:
$SERVER["socket"] == ":8443" { $HTTP["scheme"] != "https" { url.redirect = ( "." => "https://example.org/:8443" ) } }