Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

http & https


Reply


4 Posts   1244 Views

Avatar
swaiba

Forum Moderator, 1804 Posts

7 April 2011 at 4:06am

Hi,

A need has arisen for using both http and https within our site. I am curious how this works with silverstirpe - in my webroot there is 2 folders httpsdocs & httpdocs (where ss is), I can place stuff (like test.html) into the https and it shows with https://www.mysite.com/test.html. So I think I get an idea on how to working this... but...

how does this mix with silverstripe?

so do I duplicate my ss install into the httpsdocs?
how do things link Director::BaseHref work when I need to transfer from one to another for various points through the user expiernce?
is there any advice you guys could favor me with at this point?

Barry

Avatar
Devlin

Community Member, 217 Posts

7 April 2011 at 6:58am

Edited: 07/04/2011 7:02am

so do I duplicate my ss install into the httpsdocs?
Why do you want to have two setups?

how do things link Director::BaseHref
Just do if($something) Director::forceSSL();
Director::$alternateBaseURL works well too.

is there any advice you guys could favor me with at this point?
Well, sessions don't work when you move between protocols.

Avatar
swaiba

Forum Moderator, 1804 Posts

7 April 2011 at 7:06am

so do I duplicate my ss install into the httpsdocs? - Why do you want to have two setups?

Not at all! - do I adjust the .htaccess or something? As I said I have two different folders in my site httpdocs (that is my webroot) and the other is httpsdoc. If I change the http:// to https:// the pages are served fromteh other folder and there is nothing it them. Am i missunderstanding - I should have both pointing to the same folder instead?

how do things link Director::BaseHref
Just do if($something) Director::forceSSL(); else Director::forceWWW();
Director::$alternateBaseURL works well too.

Many thanks - are there any other tips you have?

is there any advice you guys could favor me with at this point? - Well, sessions don't work when you move between protocols.

Hmmmm that means that as soon as I start something that requires sessions I'll have to transfer. Then if the users transfers back they will lose their session? if they put the right protcol in again will it reuse the previous session?

Again Many thanks for you answers Devlin.

Avatar
Devlin

Community Member, 217 Posts

7 April 2011 at 7:34am

Edited: 07/04/2011 7:40am

Am i missunderstanding - I should have both pointing to the same folder instead?

I don't know your setup. For simplicity's sake I would just set the https&http DocumentRoot to the same folder and let Silverstripe do its work. When your hoster doesn't allow you to do so, then you have a problem. Maybe a symlink would do.

Many thanks - are there any other tips you have?

SS with HTTPS on a shared webhoster through a ssl proxy...
http://silverstripe.org/general-questions/show/13844

...they will lose their session?
if they put the right protcol in again will it reuse the previous session?

Yeah.