1

로컬 호스트에서 실행할 때 제대로 작동하는 각도 컨트롤러에서 간단한 HTTP 포스트 콜이 있지만 스테이지에 배포되면 403 오류가 발생합니다. 섬기는 사람. 특히 Chrome에서만 403 오류가 발생하며 IE 및 FireFox에서 정상적으로 작동합니다. 여기 크롬에서만 서버에서 403 오류를 반환하는 각도 http 게시물

var app = angular.module('app', ['ngAnimate', 'ui.bootstrap'], function($locationProvider) { 
$locationProvider.html5Mode({ 
    enabled: true, 
    requireBase: false 
}); 
}); 

app.controller('ClearFilesController', ['$rootScope', '$timeout', '$scope', '$http', '$uibModal', '$filter','$window','$location',function($rootScope, $timeout, $scope, $http, $uibModal, $filter,$window,$location) { 

$scope.message = "Clear Test Files"; 
$scope.statusMessage = "Click the button to delete test files in the 'Automation Testing' Collection"; 

$scope.deleteFiles = function(){ 
    $scope.statusMessage = "Clearing files..."; 
    $http.post('/clearFiles') 
     .then(function(response){ 
      var status = response.status; 
      if('200'!=status) { 
       $scope.statusMessage = "Clearing of files failed."; 
      } else { 
       $scope.statusMessage = "Successfully cleared files."; 
      } 
     }); 

}; 

}]); 

가 크롬의 개발 도구에서 오류입니다 : angular.js : 11,630 POST https://sample-stageserver.com/clearFiles/ 403 (금지)

가능한 이유가 될 것입니다 무엇 여기

은 JS 파일입니다 크롬에서만이 오류가 발생합니까?

+0

F12 도구의 네트워크 탭에서 다른 점을 확인하십시오 (헤더 등 ...) –

+0

나는 그것을 시도했지만 분명히 상태 코드 이외의 다른 점은 실제로 보지 못했습니다. 그 외에도별로 다르지 않았다. – Justin

+0

http://www.telerik.com/fiddler 시도 –

답변

0

의견을 추가 할 수 있습니다. 문제를 테스트하기 위해 우편 배달부를 사용해 볼 수 있습니다. 그리고 예를 들어 기본 $ http를 사용하십시오 - Angular $http doc (속기가 아님).