Javascript-ask questions about ip address switching domain name session loss

Source: Internet
Author: User
Previously, the front-end pages and interfaces were accessed by ip addresses in the server directory. after the front-end pages were accessed by a domain name, there was no need for IP addresses to access the interface, or was there a problem of cross-origin and SESSION loss? How can this problem be solved? The front-end page and interface are in the same directory as the server.
All access using ip addresses
After that, the front-end page has a domain name and does not need an IP address to access the interface or use an IP address to access the interface.
Then there is a problem of cross-origin and SESSION loss?
How can this problem be solved?

Reply content:

The front-end page and interface are in the same directory as the server.
All access using ip addresses
After that, the front-end page has a domain name and does not need an IP address to access the interface or use an IP address to access the interface.
Then there is a problem of cross-origin and SESSION loss?
How can this problem be solved?

  1. A simple and effective method is to configure a domain name for your interface

  2. Of course, there are also methods to pass session IDs through URLs, but this method has poor compatibility.

  3. Especially important !! Why does the interface need a Session !?

Generally, tokens are used for Interface Verification.
Of course, php has a session solution. it is about to get off work. I will talk about it tomorrow.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.