Linux / UNIX Tech Support Forum
This is a discussion on forwarding https://www.xxx to https://xxx in lighttpd within the Web servers forums, part of the Mastering Servers category; Hi, I am a bit stuck with how to get around lighttpd's insistence on IP-based virtual hosting when using SSL. ...
|
|||||||
| Web servers Discussion on Apache, Nginx and Lighttpd HTTP/web server and configuration issues. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi,
I am a bit stuck with how to get around lighttpd's insistence on IP-based virtual hosting when using SSL. I have an SSL site up and running with the following configuration: $SERVER["socket"] == "111.111.111.111:443" { ssl.engine = "enable" ssl.pemfile = "/etc/lighttpd/ssl.key/mydomain.com.pem" .... } So the site URL is https://mydomain.com/ But... I want to forward any requests for https://www.mydomain.com to https://mydomain.com as otherwise visitors will get a warning as the SSL cert will be invalid. I can't find any way to do this - I've tried nesting an HTTP["host"] block inside the SERVER["socket"] block, but it looks like this doesn't function at all if the site is SSL. I also tried using HTTP["url"] but that didn't work either. Help! Simon. Centos 5.2 Lighttpd 1.4.18 Serving up Django via FastCGI |
| Sponsored Links | ||
|
|
|
||||
|
Add the following lines to lighttpd.conf or your virual hosting section
Code:
$HTTP["host"] =~ "^www\.(.*)" { url.redirect = ( "^/(.*)" => "https://%1/$1" ) }
HTH
__________________
Vivek Gite Linux Evangelist |
|
|||
|
Not quite!
I'm well aware of how to redirect http to https, but what I am asking here is how to redirect https://somevalue to https://some_other_value This seems to be more difficult. |
|
||||
|
I'm sorry I cannot follow you. Can you be more specific and please add your example urls in [code] tags so that I can see it. Otherwise VB is "Automatically parsing links in text" and "automatically retrieving titles from external links"
__________________
Vivek Gite Linux Evangelist |
|
|||
|
OK, so I want all of the following options to forward to
Code:
https://sub.mydomain.com/ Code:
http://sub.mydomain.com/ Code:
http://www.sub.mydomain.com/ Code:
https://www.sub.mydomain.com/ Code:
$HTTP["host"] =~ "^(www\.)?sub\.mydomain\.com$" {
url.redirect = ( "^/(.*)" => "https://sub.mydomain.com/$$
server.name = "sub.mydomain.com"
}
|
|
|||
|
Sorry it still formatted in a way which wasn't clear!
This is the main https domain: Code:
https://sub.mydomain.com |
|
||||
|
Now, I get it you want to match all http requests including subdomains and redirect them to https domains. I had something as follows for one my domain. It redirect everything from http://example.com to http://sub.example.com to https://example.com
Code:
$SERVER["socket"] == ":80" {
$HTTP["host"] =~ "(.*)" {
url.redirect = ( "^/(.*)" => "https://%1/$1" )
}
}
__________________
Vivek Gite Linux Evangelist |
|
|||
|
Nope, the devil is in the detail!
I know how to forward from http to https I am having a problem forwarding from one https address to another! It's this url Code:
https://www.sub.mydomain.com/ Code:
https://sub.mydomain.com/ |
|
||||
|
Try selecting and matching https with $HTTP["scheme"] directive:
Code:
$HTTP["scheme"] == "https" {
....
}
Code:
$HTTP["scheme"] == "https" {
url.redirect = ("^/(isoimages/.*)" => "https://%1/$1")
}
__________________
Vivek Gite Linux Evangelist Last edited by nixcraft; 08-10-2009 at 01:00 AM. |
![]() |
| Tags |
| https , lighttpd , lighttpd http to https redirection , lighttpd ssl redirection , ssl , virtual hosting |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) |
|
| Thread Tools | |
| Display Modes | |
|
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Linux IP forwarding | varunkant | Linux software | 2 | 08-07-2008 04:15 PM |
| DNS: Conditional Forwarding | marros | Getting started tutorials | 1 | 04-07-2008 01:36 AM |
| Port forwarding | satimis | Networking, Firewalls and Security | 0 | 02-02-2008 07:45 AM |
| https error | surmandal | Web servers | 0 | 11-10-2007 12:22 PM |
| SSH via HTTPs ? | rcordeiro | Linux software | 5 | 23-06-2006 05:42 PM |