Search Support

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.

Learn More

HTTPS XMLHttpRequests at localhost return no data

  • 2 ప్రత్యుత్తరాలు
  • 18 ఈ సమస్యలు కలిగి ఉన్నాయి
  • 10 వీక్షణలు
  • చివరి సమాధానమిచ్చినది 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 చే మార్చబడినది