Views and session variables available in sub domains

Asked

Viewed 60 times

1

I am creating a web system in Windows where several sub-domains will be created to locate some services for users. Ex. panel.com, shop.dominio.com, etc.

My question is:

  • My variables created in the main domain session will be accessible to all sub-domains ?
  • There is the possibility to manage the entire application in the domain providing the views through routes to the sub domains ?

1 answer

2


It is not possible to share the native PHP session because they are different domains. In this case you will have to use a session control via Database or other data source that is accessible in a common way among all domains (main + subdomains) and take the authentication from one domain to another through variables linked to the HTTP request, whether via GET, POST or HEADER.

A Token system will also help you with this. Where each session created by a user generates a token, which will be stored in this common data source, and when you take the user to another domain, you attach this token to the request, as stated above, and validate the token in the request received in the new domain.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.