Join the AMA (Ask Me Anything) with the Firefox leadership team to celebrate Firefox 20th anniversary and discuss Firefox’s future on Mozilla Connect. Mark your calendar on Thursday, November 14, 18:00 - 20:00 UTC!

Questo sito potrebbe offrire funzionalità limitate durante le operazioni di manutenzione per migliorare l'esperienza utente. Se un articolo non risolve il tuo problema e vuoi richiedere supporto, la nostra comunità di supporto è pronta ad aiutarti tramite @FirefoxSupport su Twitter e /r/firefox su Reddit.

Cerca nel supporto

Attenzione alle mail truffa. Mozilla non chiederà mai di chiamare o mandare messaggi a un numero di telefono o di inviare dati personali. Segnalare qualsiasi attività sospetta utilizzando l'opzione “Segnala abuso”.

Ulteriori informazioni

Questa discussione è archiviata. Inserire una nuova richiesta se occorre aiuto.

HTTPS XMLHttpRequests at localhost return no data

  • 2 risposte
  • 18 hanno questo problema
  • 11 visualizzazioni
  • Ultima risposta di 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.''

Modificato da Jakub Mareda il

Tutte le risposte (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.

Modificato da Jakub Mareda il