This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn't solve your issue and you want to ask a question, we have our support community waiting to help you at @FirefoxSupport on Twitter and/r/firefox on Reddit.

تلاش سپورٹ

Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.

مزید سیکھیں

HTTPS XMLHttpRequests at localhost return no data

  • 2 جواب دیں
  • 18 میں یہ مسئلہ ہے
  • 11 دیکھیں
  • آخری جواب بذریعہ Jakub Mareda

more options

I made myself an userscript that gathers certain data from websites I browse and stores them in cache on localhost.

First I used to make standart cross-site HTTP XMLHttpRequests, however the firefox has implemented another XHR restriction that prevents me from doing so - mixed content blocking.

However, on firefox blog I saw information, that HTTPS requests are considered safe and are not blocked. So I added security exception for localhost, and changed requests to https requests. (and even https requests from localhost to localhost behave that way)

Now the requests are being sent properly, but no data are received from server. Why is that? How many security policies has firefox put in front of me?

Oh and sorry guys, I've forgotten to specify error messages upon each situation:

a) Cross-site http request: "Blocked mixed content..." Normal http request within localhost works.

b) Cross-site and normal https request: "Certificate not trusted beacuse its self signed"

c) Cross-site and normal https request with certificate exception: nothing. Not even a notice.

I made myself an userscript that gathers certain data from websites I browse and stores them in cache on localhost. First I used to make standart cross-site HTTP XMLHttpRequests, however the firefox has implemented another XHR restriction that prevents me from doing so - mixed content blocking. However, [https://support.mozilla.org/en-US/kb/how-does-content-isnt-secure-affect-my-safety?as=u&utm_source=inproduct on firefox blog] I saw information, that HTTPS requests are considered safe and are not blocked. So I added security exception for localhost, and changed requests to https requests. (and even https requests from localhost to localhost behave that way) Now the requests are being sent properly, but no data are received from server. Why is that? How many security policies has firefox put in front of me? Oh and sorry guys, I've forgotten to specify error messages upon each situation: '''a)''' Cross-site http request: "''Blocked mixed content...''" Normal http request within localhost works. '''b)''' Cross-site and normal https request: "''Certificate not trusted beacuse its self signed''" '''c)''' Cross-site and normal https request with certificate exception: nothing. Not even a notice.''

Jakub Mareda کی جانب سے میں ترمیمکی گئ

تمام جوابات (2)

more options

Could you check the Browser Console (Ctrl+Shift+j) for any specific error messages about the request.

What is the security exception for localhost?

By the way, if you are using different ports on localhost, I believe CORS headers are required in that scenario.

Also, it's not cross-browser, but if you are running your script in Greasemonkey, the GM_xmlHttpRequest method historically has been able to bypass cross-domain security restrictions. (I think it lies to the destination site and tells it that it also is the requesting host site.)

more options

About error messages: I'm sorry, I've forgotten to mention this. I'm actually posting here because I did not receive any error for the last situation.

The security exception for localhost is just standart exception that is made by hitting site with "https://" in the adress bar. If you do this for a site, evil dialog will ask you whether you know what are you doing and if you say that you do, you get that exception/

Maybe I'll try to make a demo for this problem, but I'm not ure how it's gonna behave online.

Jakub Mareda کی جانب سے میں ترمیمکی گئ