作为我正在开展的项目的一部分,我们需要发送跨域请求 . 我有以下电话:
$http({
url: 'http://192.168.1.1/API/Login',
method: "POST",
data: {
password: $scope.pass
},
withCredentials: true,
cached: false,
headers: {
'Content-Type': 'application/x-www-form-urlencoded',
'Accept': 'application/json',
}
}).then(function successCallback(response) {
}, function errorCallback(response) {
});
当我将请求发送到非原始服务器时,我收到以下响应(来自Wireshark):
POST /API/Login HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Accept: application/json
Accept-Language: en-US,en;q=0.7,he;q=0.3
Origin: http://myserver.com
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64