Cross-domain problem understanding

1. There is no cross domain for simple requests

Simple requests need to meet the following conditions:

    1)请求方法是以下三种方法之一:head、get、post

    2)HTTP的头信息不超出以下几种字段:Accept 、Accept-Language、Content-Language、Width、Viewport-Width

    3)Content-Type的值只有以下三种:text/plain、multipart/form-data、application

Additionally, complex requests

example:

$scope.loginAms = function() {
     var url = "http://localhost:8081/ams_web/login?username=admin&password=123456";
       $http.post(url).success(function() {
           window.location.href = "http://localhost:8081/ams_web";
       })
   };

insert image description here
This kind of url carrying parameters to send requests in post mode is a simple request, and there will be no cross-domain, but if you use the usual json method to pass parameters and set content-type, cross-domain problems will occur

Guess you like

Origin blog.csdn.net/huan1213858/article/details/130767546