Cross-domain issues and solutions in Vue projects
May 03, 2018 am 10:20 AMThis time I will bring you cross-domain issues and handling methods in the Vue project. What are the precautions for cross-domain issues and handling methods in the Vue project? The following is a practical case, let's take a look.
Problem description
Front-end vue framework, background php, Baidu cross-domain problem background add this codeheader("Access-Control-Allow-Origin: *");
The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'. The value of the 'Access-Control-Allow-Origin' header in the response must not be the wildcard '*' when the request's credentials mode is 'include'.
Solution
Article link: CORS: credentials mode is 'include'xhrFields: { withCredentials: false },
withCredentials: true to
withCredentials: false. Of course, this error will not be reported if you do not add the above code. Although the solution is very simple, I found that I have not mastered a lot of knowledge and have to sort it out.
Access-Control-Allow-Origin to "*". Because the request header carries
Cookie information. To set the value of Access-Control-Allow-Origin to http://www.zrt.local:8080.
Set-Cookie field, trying to modify the Cookie. If the operation fails, an exception
will be thrown.
crossDomain: true, xhrFields: { withCredentials: true }
Access-Control-Allow-Origin: 'http://www.zrt.local:8080' Access-Control-Allow-Credentials: true
crossDomain: true, xhrFields: { withCredentials: true }
How to use jQuery to automatically add when the input text exceeds the specified number of lines after obtaining the ModelAndView Ellipses
The above is the detailed content of Cross-domain issues and solutions in Vue projects. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

The operation process of WIN10 service host occupying too much CPU

A quick guide to CSV file manipulation

Learn how to handle special characters and convert single quotes in PHP

How to solve the problem that jQuery cannot obtain the form element value

Teach you how to diagnose common iPhone problems

What are the questions in the Rulong 8 Wine Master exam?

PHP string processing: How to remove the first character on the right?

What happens if there is a problem with the sound card driver?
