Ashley Banks
Ashley Banks

Reputation: 528

Losing session after page load after move to SSL

UPDATE:

The site now works on all browsers BUT Chrome now. Which I think is very odd - it's all arisen since the server switched to having an SSL.

As a recommendation I have put this within the application:

ini_set('session.use_trans_sid', true);
ini_set('session.use_cookies', true);
ini_set('session.use_only_cookies', true);

$https = false;

if(isset($_SERVER['HTTPS']) and $_SERVER['HTTPS'] != 'off') {
    $https = true;
}

$dirname = rtrim(dirname($_SERVER['PHP_SELF']), '/') . '/';

session_name('money');
session_set_cookie_params(0, '/', $_SERVER['HTTP'], $https, true);
session_start();

But still I just can't get the session to set - the application is based around MVC so the controllers are required in depending on the page loaded within the URL.

Could there be an issue with Sessions being passed through required/included files?

Upvotes: 2

Views: 766

Answers (2)

Zaheer Ahmed
Zaheer Ahmed

Reputation: 28538

HTTP session ID is not being passed to the HTTPS session, when you switch between the HTTP and HTTPS services on the same server,. You can set it by passing the session ID from HTTP to HTTPS.

You can manage session between HTTP to HTTPS or HTTPS to HTTP:

  1. Transmit session ID between page using GET
  2. POST session ID by POST
  3. Use files to save sessions
  4. Use Cookies for sessions
  5. Use database to save session

Upvotes: 0

Ashley Banks
Ashley Banks

Reputation: 528

Was to do with a Favicon.ico being requested by chrome - I would never have guessed.

Thanks so much to everyone that helped!

Upvotes: 6

Related Questions