[2.0] optional "force ssl" in config

Discussion corner for Developers of Serendipity.
Post Reply
bernd_d
Regular
Posts: 468
Joined: Thu Jun 03, 2010 9:28 am
Contact:

[2.0] optional "force ssl" in config

Post by bernd_d »

I think it could be nice to have an option within core-settings like force ssl

If checkbox is selected and config is saved, following lines need to be included within .htaccess

Code: Select all

RewriteCond %{SERVER_PORT} !^443$
RewriteRule (.*) https://%{HTTP_HOST}/$1 [R=301,L]
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: [2.0] optional "force ssl" in config

Post by garvinhicking »

Hi!

Problem with this, what with people who have no mod_rewrite or are using IIS, or whatever, this would require a depending option check, so that it's only available if urlrewriting=mod_rewrite. So it's sadly not as straight-forward as it might sound, but it would be a nice thing to have.

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
bernd_d
Regular
Posts: 468
Joined: Thu Jun 03, 2010 9:28 am
Contact:

Re: [2.0] optional "force ssl" in config

Post by bernd_d »

It's just a suggestion :)

Don't know how, for example Piwik, does it. There i only have to set an value within config-file and php/script/whatever redirects without modify something in htaccess.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: [2.0] optional "force ssl" in config

Post by garvinhicking »

Hi!

I think we should better add a PHP check for this, then also people without mod_rewrite could get it,something like:

Code: Select all

if (serendipity_db_bool($serendipity['use_ssl']) && $_SERVER['HTTPS'] != 'on') {
  header('Location: https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
}
Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Post Reply