Buggy redirects when using https/SSL (version 1.28 - 2.01)

6 posts by 3 authors in: Forums > CMS Builder
Last Post: January 11, 2010   (RSS)

By webdude - April 24, 2009 - edited: January 10, 2010

Hello!

We found a couple buggy redirects after switching our installation to https. Some of the built-in redirects are hard-coded to urls with the regular http prefix which results in redirecting to the wrong url.

On example of such a function is logout. Clicking logout should redirect the user to https://myserver.com/admin.php but instead it is going to http://myserver.com/admin.php

After searching through I found at least 4 files where the http: was hardcoded into the redirect (meaning it wasn't checking to see if the install is running on a SSL connection). Instead of mucking around in all those places I found an easy way to fix it by adding the following line in the redirectBrowserToURL function:$url = preg_replace('|^https?://|i', @$_SERVER['HTTPS'] == 'on' ? 'https://' : 'http://', $url);It would be great if something like this can be included in the next bugfix release.

Thanks!

PS it would not be a good idea to use my fix if the redirectBrowserToURL function is being used by the code to redirect to sites other than the HTTP_HOST on which the install is running, because then the $_SERVER['HTTPS'] would be completely irrelevant.

Re: [webdude] Buggy redirects when using https/SSL (version 1.28)

By ross - April 24, 2009

Hi there.

Thanks for the post!

I'll make a note of this and make sure we take a look at getting the fix into the next version.

Let me know if anything else comes up :).
-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/

Re: [webdude] Buggy redirects when using https/SSL (version 1.28)

By Dave - April 29, 2009

Thanks for the report! We've fixed this for 1.29 (the next release in development).
Dave Edis - Senior Developer
interactivetools.com

Re: [webdude] Buggy redirects still here when using HTTPS :(

By Dave - January 11, 2010

Hi webdude,

Awesome bug report, thanks! :) I've applied all those patches.

For the last one, can you try just removing the $port code from thisPageUrl()?

According to RFC 2616 (Section 14.23) it sounds like it's valid for HTTP_HOST (Host header) to include the port number, and there could be a scenario where SERVER_PORT isn't valid (as the originating server is behind a proxy or load balancer and runs on a different port).

Let me know if that works for you.

Thanks again! :)
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Buggy redirects still here when using HTTPS :(

By webdude - January 11, 2010

Hi Dave,

Great! Thanks for listening!