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.

Customising the CMS /

Problem with SSL Redirects


Reply


2 Posts   1728 Views

Avatar
timp

Community Member, 4 Posts

9 September 2009 at 2:12pm

Hello,

we're building a site using silverstripe 2.3.3, but we've ran into a problem with ssl redirects for some page types.

we have
"
   function init() {
      parent::init();

      // causes a HTTP Redirect if in Non-SSL mode
      Director::forceSSL();

      // Avoid that all pages are linked as SSL
      Director::setBaseURL($this->absoluteBaseUrlWithoutSSL());

   }
   public function absoluteBaseUrlWithoutSSL() {
      $base =dirname(dirname($_SERVER['SCRIPT_NAME']));
      $base = Director::absoluteURL($base);

      if(preg_match('/^https\:\/\//i', $base)) $base = preg_replace('/^https\:\/\//i', 'http://', $base);
      $base .= '/';

      return $base;
   }
"
in the controller for the page type, and have

"Director::set_environment_type("live");"

in mysite/_config.php, but when i try to access the page, i get a page saying

"Your browser is not accepting header redirects

Please click here"

has anyone ran into this before? or know how to fix it?

Cheers,
Tim

Avatar
socks

Community Member, 190 Posts

15 October 2009 at 1:58pm

I experienced the same "Your browser is not accepting header redirects" issue and would like to know if there's an answer. It also appears in the DataObjectManager pop-up window when adding new objects.