'precondition Failed'에 해당되는 글 1건

  1. 2015.03.05 jQuery ajax 통신시 412 Precondition Failed.
JQuery2015. 3. 5. 15:29

개발중 List에서 URL을 꺼내와 URL에서 JSON을 가져다 데이터를 가공하는 코드를 짜고 있었다.


$.ajax({

            type : "POST",

            url : jsonList.jsonUrl,

            dataType : "JSON", // 옵션이므로 JSON으로 받을게 아니면 안써도 됨

async : false,

        success : function(data) {

...

        },

        complete : function(data) {

           ...

        },

        error : function(xhr, status, error) {

...

        }

    });


위의 코드를 List길이 만큼 반복문을 돌며 데이터를 가져오는 부분인데 Safari를 제외한 모든 브라우저에서는 정상 작동을 했다.

하지만 Safari에서만 일부 데이터가 누락 되는것을 확인.

콘솔을 보니 Json파일을 제대로 못읽어 오는 에러가 발생을 했다.


Failed to load resource: the server responded with a status of 412 (Precondition Failed).


위와 같은 에러가 발생하는것을 알 수 있었다.

문제 해결은 POST방식으로 데이터를 호출 하던것을 GET으로 바꾸면서 해결이 되었는데..

이게 대체 어떤 이유에서 발생하는건지 모르겠다.

일단은 해결채근 찾긴했는데 왜그런지를 좀더 찾아봐야 할것 같다.


412 Status Code Explained


A 412 status code indicates that one of the conditions the request was made under has failed. A precondition specified in one or more Request-Header fields returned false.


Why it occurs


The server does not meet one of the preconditions that the requester put on the request. i.e.,The header of the request specified information about acceptable files that is not applicable to the requested file.



Fixing 412 Error Code


The problem can only be resolved by examining what your client system is trying to do and then discussing with your ISP why the Web server fails the 'Precondition' specification sent by the client system. If you are monitor your website through 100pulse, we will intimate whenever you encounter 412 status code error through e-mail or Short message service.


Status 412에 원인의 위와 같다.

서버가 원하는 요청에서 False를 반환해서생기는 에러라는데..영어를 자세히 모르니 답답하네..


412 Precondition Failed 에 대한 설명이 있는 사이트 링크 http://www.checkupdown.com/status/E412.html

Posted by Z700zZz