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

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

  • Akukho zimpendulo
  • 1 inale nkinga
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(`[...]')

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.

Ama-screenshot ananyekiwe

Okulungisiwe ngu jost.oppenheimer

Kufanele ulogele ukungena ku-akhawunti yakho ukuze uphendule amaphosti. Uyacelwauqale umbuzo omusha, uma ungekabi nayo i-akhawunti namanje.