Die Funktionalität dieser Website ist durch Wartungsarbeiten eingeschränkt, die Ihr Erlebnis verbessern sollen. Wenn ein Artikel Ihr Problem nicht löst und Sie eine Frage stellen möchten, können Sie unsere Gemeinschaft über @FirefoxSupport auf Twitter, /r/firefox oder Reddit fragen.

Hilfe durchsuchen

Vorsicht vor Support-Betrug: Wir fordern Sie niemals auf, eine Telefonnummer anzurufen, eine SMS an eine Telefonnummer zu senden oder persönliche Daten preiszugeben. Bitte melden Sie verdächtige Aktivitäten über die Funktion „Missbrauch melden“.

Weitere Informationen

firefox blocks ajax http request

  • 4 Antworten
  • 2 haben dieses Problem
  • 31 Aufrufe
  • Letzte Antwort von 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.

Alle Antworten (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?

Geändert am von petr.sponky

more options

Delete this item.

Geändert am von petr.sponky

more options

Is there anybody to help me?

more options

Nice community support. Thanks.