在我下面角的應用程序是我得到的錯誤,當我嘗試在本地開發登錄器(Chrome):的XMLHttpRequest無法加載迴應預檢要求未通過訪問控制檢查
XMLHttpRequest cannot load https://www.tickertags.com/app/api/login.
Response to preflight request doesn't pass access control check:
The 'Access-Control-Allow-Origin' header has a value 'http://localhost:8100'
that is not equal to the supplied origin.
Origin 'http://localhost' is therefore not allowed access.
登錄從我的LoginController
function login(credentials) {
console.log('credentials',credentials);
AuthFactory.login(credentials).then(function (user) {
$rootScope.$broadcast(AUTH_EVENTS.loginSuccess);
$scope.setCurrentUser(user);
if (user.password_reset) {
$location.path('/password');
} else {
$location.path('/tickers');
}
}, function() {
console.log('"Invalid Username/Password"');
$scope.loginData.message = "Invalid Username/Password";
$rootScope.$broadcast(AUTH_EVENTS.loginFailed);
}, function() {
console.log('"Invalid Username/Password"');
$scope.loginData.message = "Invalid Username/Password";
$rootScope.$broadcast(AUTH_EVENTS.loginFailed);
});
}
的AuthFactory.login
功能功能打即生產託管的API。我不確定我錯過了什麼?這是我的本地主機鏈接看起來像http://localhost/static/manage/v2/#/login
看看本頁右側的所有***相關問題***。他們每個人都是同一個話題。問題出現在這裏每天無數次,並不難研究 – charlietfl
是的,我已經經歷了其中5個到目前爲止,沒有我覺得回答我的問題:(我看到有更多,現在經歷他們 –
沒有您與我們分享的代碼會設置原始標題,所以我們無法分辨爲什麼它將Access-Control-Allow-Origin設置爲「http:// localhost:8100」,而不是「http:// localhost」, – Quentin