Цей вебсайт матиме обмежену функціональність, доки ми проводимо його обслуговування для поліпшення роботи. Якщо прочитана стаття не розв'язала вашу проблему і ви хочете поставити питання, наша спільнота підтримки з радістю допоможе вам на @FirefoxSupport у Twitter та /r/firefox на Reddit.

Шукати в статтях підтримки

Остерігайтеся нападів зловмисників. Mozilla ніколи не просить вас зателефонувати, надіслати номер телефону у повідомленні або поділитися з кимось особистими даними. Будь ласка, повідомте про підозрілі дії за допомогою меню “Повідомити про зловживання”

Докладніше

Ця тема перенесена в архів. Якщо вам потрібна допомога, запитайте.

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