Annoying SSL Refresh

[quote name=‘indy0077’]Hmmm, I see, but is it a coding problem?[/QUOTE]



Personally I would not call it a coding problem, I just see it as an area which needs some more thought & improvement! :wink:

Not a coding problem, it works just fine, it’s the fact that they decided to go from https to http.via refresh or header('Location:



I think this can be found in core/fn.common.php starts on line 136:

// Redirect from https to http location

[quote name=‘ePlanetDesign’]Not a coding problem, it works just fine, it’s the fact that they decided to go from https to http.via refresh or header('Location:



I think this can be found in core/fn.common.php starts on line 136:

// Redirect from https to http location[/QUOTE]



Hello ePlanetDesign,



Ok, I just removed the chunk of code in core/fn.common.php for the https to http refresh, and it definately speeds up the switch making it feel much more seamless! I have no idea as to whether this will create other problems, so be warned! :slight_smile:



This is what lines 136 through 140 now look like:


// Redirect from https to http location

}

if (!ob_get_contents() && !headers_sent() && !defined('META_REDIRECT')) {




See what you think!

[quote name=‘Struck’]Hello ePlanetDesign,



Ok, I just removed the chunk of code in core/fn.common.php for the https to http refresh, and it definately speeds up the switch making it feel much more seamless! I have no idea as to whether this will create other problems, so be warned! :slight_smile:



This is what lines 136 through 140 now look like:


// Redirect from https to http location

}

if (!ob_get_contents() && !headers_sent() && !defined('META_REDIRECT')) {




See what you think![/QUOTE]



I was just coming here to post the same thing, Struck!



They are currently using a meta refresh for the redirect when going from https to http. For http to https though they use a header redirect which is faster and not noticeable to the user. With Struck’s change it now uses a header redirect for both.

[quote name=‘adodric’]I was just coming here to post the same thing, Struck!



They are currently using a meta refresh for the redirect when going from https to http. For http to https though they use a header redirect which is faster and not noticeable to the user. With Struck’s change it now uses a header redirect for both.[/QUOTE]



Hello Adodric,



Are you noticing a definate improvement as well, because I am really liking the results so far? !



I have been browsing back & forth between various secure & non-secure areas of our site & just placed a test order (via purchase order, not credit card gateway) and so far appears to work fine.

[quote name=‘Struck’]Hello Adodric,



Are you noticing a definate improvement as well, because I am really liking the results so far? !



I have been browsing back & forth between various secure & non-secure areas of our site & just placed a test order (via purchase order, not credit card gateway) and so far appears to work fine.[/QUOTE]



I’m not sure why they decided to implement redirects from https to http via a meta tag refresh. That method has a few drawbacks a few of which are: slower speed, it is noticeable by the user, some browsers will not allow you to use the back button to get to the previous page.



To answer your question, yes, this is a big improvement, one that should be changed/fixed in the base code by CS Cart for future releases. Using a header redirect is much faster, nothing on a page loads with this method. It shouldn’t break anything with the cart, the other sections that still use a meta redirect do, for example importing products.

Ok, thanks for the update.



I am just hoping some others try this out & test thoroughly because I am not a coder by any means, often wish I was, however, there are only so many hours in a day! :wink:

I was thinking more like this:



```php

// Redirect from https to http location

if ($protocol_changed && defined(‘HTTPS’)) {

//$no_delay = true;

//fn_define(‘META_REDIRECT’, true);

header('Location: ’ . $location);

exit();

}

```



Maybe that if statement is in there for a reason.

[quote name=‘ePlanetDesign’]I was thinking more like this:



```php

// Redirect from https to http location

if ($protocol_changed && defined(‘HTTPS’)) {

//$no_delay = true;

//fn_define(‘META_REDIRECT’, true);

header('Location: ’ . $location);

}

```



Maybe that if statement is in there for a reason.[/QUOTE]



You want to actually put “exit();” after your header line there otherwise it runs the rest of the function which just directs it to another call of the same exact header rewrite.

[quote name=‘adodric’]You want to actually put “exit();” after your header line there otherwise it runs the rest of the function which just directs it to another call of the same exact header rewrite.[/QUOTE]



I had it in there and removed it from my post, but it’s in there in my code.



Hope this works.

[quote name=‘ePlanetDesign’]I was thinking more like this:



```php

// Redirect from https to http location

if ($protocol_changed && defined(‘HTTPS’)) {

//$no_delay = true;

//fn_define(‘META_REDIRECT’, true);

header('Location: ’ . $location);

exit();

}

```



Maybe that if statement is in there for a reason.[/QUOTE]



ePlanet’s method is also working fine in 2.0.14!



After upgrading, I quickly realized how much of a benefit this makes switching back & forth between https to http pages & quickly re-added this back in to our install!



This really needs to be considered as a product enhancement & added into the core release!



Unfortunately I can’t add this to the ideas section as I am out of votes. Requiring a vote to add an Idea needs to be re-thought otherwise active CS-Cart forum members cannot continue to contribute valuable ideas in making CS-Cart a better product! :frowning:

[quote name=‘Struck’]Unfortunately I can’t add this to the ideas section as I am out of votes. Requiring a vote to add an Idea needs to be re-thought otherwise active CS-Cart forum members cannot continue to contribute valuable ideas in making CS-Cart a better product! :([/QUOTE]

Absolutely. I have several ideas I would like to add but cannot. Until they address this glaring failure, they will have no central repository for all suggestions for the cart’s improvement.



Bob

[quote name=‘jobosales’]Absolutely. I have several ideas I would like to add but cannot. Until they address this glaring failure, they will have no central repository for all suggestions for the cart’s improvement.



Bob[/QUOTE]



Yes, I view it as the most valuable input for improvements, will for the most part, come from long time active users such as yourself. And, although I do like the idea of eliminating “Feature Requests” from the bugtracker, until they re-think the Idea’s require a vote bottleneck, alot of valuable suggestions for improvement will be lost.

There are always great post in the forum but this one was fantastic, thanks so much for sharing the fix for something that was making me batty. The best part it was easy to edit and it works !

Hi ALL



I have just made the change and “what a difference”!!!



Superb job!



Thanks :stuck_out_tongue:

Hi,



I just made this change to my live site and i have to say this is a huge improvement on the originally coded solution. This should be part of the core code in my opinion.



Regards,

Aleks

I agree this is a huge improvement. This should be part of the default installation.

I’ve added this to the ideas area and given it three votes. If you like it you can edit your current votes to make this more noticed. I’d think it would be a simple change for the developers once they know about it so lets throw in some votes and get it done.

[quote name=‘ePlanetDesign’]I was thinking more like this:



```php

// Redirect from https to http location

if ($protocol_changed && defined(‘HTTPS’)) {

//$no_delay = true;

//fn_define(‘META_REDIRECT’, true);

header('Location: ’ . $location);

exit();

}

```



Maybe that if statement is in there for a reason.[/QUOTE]



Fantastic fix! Thank you so much!

I gave it three votes.



Vote people, here’s the link:

[url]http://cscart.uservoice.com/forums/40782-general/suggestions/622947-change-the-code-in-core-fn-common-php-to-speed-up-?ref=title[/url]