preface
At present, the company has two platforms, one is for ordinary users to use the h5 client and provide enterprises with services of PCWeb side, the two platforms are sharing a set of login system and user system, over time, in order to distinguish between different business scenarios result in the field of the user system there is a large amount of redundancy, this time is about to start refactoring, the original user separation, but still use the same set of login system. In the process of reconstruction, because of the wrong judgment of the Cookie caused some problems, went a lot of detours, so I decided to record these problems, as a warning.
Cookie is a string of strings written by the server to the client browser, mainly including keys, values, expiration time, path and domain, here mainly says the use of domain.
1. Domain domain don’t fill in
The default is only valid under the current domain
2. The domain specified domain
The cookie is valid for the specified domain and for all subdomains under the domain. This means that the browser automatically puts the cookie in the request header when accessing a resource under a valid domain name
3. Implementation of SSO Single Sign-On
Suppose the login domain name is login.olang.cn, and the login sites need to be verified are a.olange.cn and b.olange.cn. When I access a.olange.cn, because I have not logged in at this time, I will jump to the login page on login.olange.cn. After submitting the login name and password, the verification is successful, and then I will start writing the token into the Cookie. Set the cookies’ domain to their parent domain olange. CN, so that browsers will carry the token when accessing a.olange. CN and b.olange. CN
4. Can the domain be set freely
Yes, but the browser won’t accept it. For security reasons, the browser will only store cookies from the current domain and its parent domain; the rest will be discarded.
Read More:
- Solutions to cookie output failure
- Phpcms development problems and Solutions
- Some problems and solutions of Java Web
- Common problems and solutions under Linux
- Linux common problems and Solutions
- Problems and solutions of installing Ubuntu 12.04 in win7
- Problems and solutions in using Linux
- The corresponding solutions to the problems of various external symbols that cannot be resolved
- OpenGL learning notes: Problems and Solutions
- Possible causes and solutions of 404 problems in accessing servlet pages
- Problems and solutions in learning opengl
- Eclipse package explorer related problems and Solutions
- Solutions to the problems of unsuccessful installation of winpcap4.13 under win10
- OpenGL Usage Summary (including problems encountered and solutions)
- Write about the problems and solutions when configuring OpenGL in vs2015
- Solutions to problems encountered when installing isc-dhcp-server on debian9.6
- Configuration of OpenGL under CodeBlocks and solutions to problems encountered
- Solutions to some problems encountered in programming with vs2017
- Solutions to network connection problems in Ubuntu 16.04.3
- Solutions to problems in SAS 9.3 x64 importing and exporting Excel