Search Support

Subsequent API fetch requests switching from http/1.1 to http/2

  • Нет ответов
  • 1 имеет эту проблему
  • 2 просмотра
more options

hi! I'm currently following a course on react developement and i'm running into an issue specifically on firefox, both normal and developer edition( normal version 76.0.1, dev version 77.0b7).

I'm using axios to fetch weather data from weatherstack, which only offers http requests to free users, using the following line: axios.get(`http://api.weatherstack.com/[...]')

the first time during runtime, when i am fetching data, the request is using protocol http/1.1, which works fine. Any further requests start using http/2 however, which results in weatherstack sending back an error message saying "Access Restricted - Your current Subscription Plan does not support HTTPS Encryption." ( but with http status 200, which is kinda weird in itself).

looking into axios, (specifically how axios.get() works) it seems they are letting the browser decide on how to handle the request, so i came here.

This works fine on chrome(Version 83.0.4103.61), sending all requests via http/1.1

now my questions am i correct in assuming this is a security feature doing this? if so, why is it not doing it on the first request? how would i go about getting this to work or should i use a different api that accepts https if i want this to work on firefox?

thanks in advance!

edit: on further investigation, this behaviour is confined within a tab, so even if you reload the site, it still uses http/2. if you open the site in a new tab, the first request works and further requests do not.

Приложенные скриншоты

Изменено jost.oppenheimer

Для ответа на сообщения вы должны войти в свою учётную запись. Пожалуйста, задайте новый вопрос, если у вас ещё нет учётной записи.