views:

8

answers:

1

Hello to all,

I have a problem related to subdomain and https request.

I am trying to route from http to https where my http address is subdomain.domain.com and https address is domain.com/subdomain. But the problem is when i switched from http to https i loose my session variables.

How can i persist my session variables in both http and https requests.

Thank you.

A: 

The session is probably tracked by a cookie.

Cookies have a domain associated with them, in this case this would be "subdomain.domain.com". For a different domain, even if it is the parent domain, the cookie will not be provided by the web browser.

I think there are ways to make a cookie valid for all subdomains under a given domain, but you have to look into the documentation of the software you are using for that.

For any more information, we really need more detail about what software you are using to keep this session. Standard PHP sessions? Or something else?

Erik