본 사이트는 여러분의 사용자 경험을 개선하기 위해 유지 보수를 진행하는 동안 기능이 제한됩니다. 도움말로 문제가 해결되지 않고 질문을 하고 싶다면 Twitter의 @FirefoxSupport 및 Reddit의 /r/firefox 채널을 활용하세요.

Mozilla 도움말 검색

고객 지원 사기를 피하세요. 저희는 여러분께 절대로 전화를 걸거나 문자를 보내거나 개인 정보를 공유하도록 요청하지 않습니다. "악용 사례 신고"옵션을 사용하여 의심스러운 활동을 신고해 주세요.

자세히 살펴보기

firefox blocks ajax http request

  • 4 답장
  • 2 이 문제를 만남
  • 31 보기
  • 최종 답변자: petr.sponky

more options

Hello, I have problem with Firefox when web application goes on https and there is ajax request to http. Firefox say: Cross-Origin Request Blocked: The Same Origin policy disallows reading the remote resource at http://localhost/... (Reason: CORS request did not succed). Problem is firefox doesn't send OPTION request to web api. So server part is not in game. When I change address to web api to https, firefox sends OPTION request. IE, Edge, Chrome, Opera works fine. Problem is firefox only. Why? How can I change settings to send ajax request to http when web application is on https? I cannot change web api to https! I try send request through XMLHttpRequest in javascript. I tried to set up security.fileuri.strict_origin_policy to false but nothing change. I tried to add <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" /> tag into page but nothing change. When I downgrade application to http it works fine. So I think there should not be problem on server side. There are following headers on server side: "Access-Control-Allow-Origin", "*" "Access-Control-Allow-Methods", "POST, OPTIONS, GET" "Access-Control-Allow-Headers", "Content-Type, Accept, Authorization, x-requested-with"


There is function which is in web application: function SendData(url, data, handler) {

       var invocation = new XMLHttpRequest();
       invocation.open("POST", url, true);
       invocation.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
       invocation.onreadystatechange = function () {
           if (this.readyState == 4 && this.status == 200)
               handler(invocation.responseText, this.status);
       }
       invocation.send(data);
   }

I need help to solve this problem to send ajax request from https web application into http web api. Thank you.

Hello, I have problem with Firefox when web application goes on https and there is ajax request to http. Firefox say: Cross-Origin Request Blocked: The Same Origin policy disallows reading the remote resource at http://localhost/... (Reason: CORS request did not succed). Problem is firefox doesn't send OPTION request to web api. So server part is not in game. When I change address to web api to https, firefox sends OPTION request. IE, Edge, Chrome, Opera works fine. Problem is firefox only. Why? How can I change settings to send ajax request to http when web application is on https? I cannot change web api to https! I try send request through XMLHttpRequest in javascript. I tried to set up security.fileuri.strict_origin_policy to false but nothing change. I tried to add <meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests" /> tag into page but nothing change. When I downgrade application to http it works fine. So I think there should not be problem on server side. There are following headers on server side: "Access-Control-Allow-Origin", "*" "Access-Control-Allow-Methods", "POST, OPTIONS, GET" "Access-Control-Allow-Headers", "Content-Type, Accept, Authorization, x-requested-with" There is function which is in web application: function SendData(url, data, handler) { var invocation = new XMLHttpRequest(); invocation.open("POST", url, true); invocation.setRequestHeader("Content-Type", "application/json;charset=UTF-8"); invocation.onreadystatechange = function () { if (this.readyState == 4 && this.status == 200) handler(invocation.responseText, this.status); } invocation.send(data); } I need help to solve this problem to send ajax request from https web application into http web api. Thank you.

모든 댓글 (4)

more options

I added image where you can see OPTION request is not send when I call http page on localhost but it is send when I call https page on localhost. I need to solve this issue to send option request on http page on localhost when web application is on https. How to do it?

글쓴이 petr.sponky 수정일시

more options

Delete this item.

글쓴이 petr.sponky 수정일시

more options

Is there anybody to help me?

more options

Nice community support. Thanks.