Git Product home page Git Product logo

Comments (13)

derhuerst avatar derhuerst commented on June 2, 2024

HTTP 418 is an April Fool's Day joke, so either FlightRadar24 is trolling you or you have a malfunctioning setup.

Can you give me more details in order to reproduce the problem? Maybe all parameters or even a curl command (you can get that from the Chrome network inspector)?

from flightradar24-client.

juiceo avatar juiceo commented on June 2, 2024

Hey, thanks for the quick response.

So my code is exactly the same as the example code in README, and when I try the same request url in a browser it works as expected. Request url is: https://data-live.flightradar24.com/zones/fcgi/feed.js?bounds=53%2C52%2C13%2C14&callback=jsonp&faa=1&flarm=1&mlat=1&adsb=1&air=1&gnd=0&vehicles=0&gliders=0

There's a couple of issues that Chrome is complaining about:

  • Refused to set unsafe header "user-agent"
  • No 'Access-Control-Allow-Origin' header is present. This is likely not related, I am able to fix it a CORS plugin in chrome.

image

cURL for the request:

curl 'https://data-live.flightradar24.com/zones/fcgi/feed.js?bounds=53%2C52%2C13%2C14&callback=jsonp&faa=1&flarm=1&mlat=1&adsb=1&air=1&gnd=0&vehicles=0&gliders=0' -H 'origin: http://localhost:3000' -H 'accept-encoding: gzip, deflate, br' -H 'accept-language: en-GB,en;q=0.8,en-US;q=0.6,fi;q=0.4' -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36' -H 'accept: /' -H 'referer: http://localhost:3000/' -H 'authority: data-live.flightradar24.com' --compressed

from flightradar24-client.

derhuerst avatar derhuerst commented on June 2, 2024

when I try the same request url in a browser it works as expected. Request url is: [...]

cURL for the request: [...]

The curl command reproduces the 418 error. It is certainly a weird choice done by FlightRadar24 to return an "I'm a teapot" error on any of their public routes.

No 'Access-Control-Allow-Origin' header is present. This is likely not related, I am able to fix it a CORS plugin in chrome.

I will fix this. My code already fetches in CORS mode, so this must be your setup.

from flightradar24-client.

derhuerst avatar derhuerst commented on June 2, 2024

I successfully nailed it down to the Referer: http://localhost:3000/ header. Referer: http://foo.bar.horse:3000/ works fine.

from flightradar24-client.

derhuerst avatar derhuerst commented on June 2, 2024

Maybe we can ping someone from @Flightradar24 ?

from flightradar24-client.

juiceo avatar juiceo commented on June 2, 2024

Hmm, so is there a way I can hack the referer to an ok value to make it work? For my use case it would just probably be running on localhost and be displayed on a screen

from flightradar24-client.

derhuerst avatar derhuerst commented on June 2, 2024

FlightRadar24 may try to block unauthorised access to their API using this trick. I can set up a CORS proxy that strips the Referer at any time though to circumvent it.

I will try to set the referrer option of fetch to no-referrer. But I'm not sure it's supported in every browser.

from flightradar24-client.

derhuerst avatar derhuerst commented on June 2, 2024

Can you confirm it's fixed as of the current master (3eae7ab)?

from flightradar24-client.

juiceo avatar juiceo commented on June 2, 2024

hmm, still facing the same issue with 3eae7ab (0.2.1). Tested on chrome and firefox.

cURL:

curl 'https://data-live.flightradar24.com/zones/fcgi/feed.js?bounds=53%2C52%2C13%2C14&callback=jsonp&faa=1&flarm=1&mlat=1&adsb=1&air=1&gnd=0&vehicles=0&gliders=0' -H 'origin: http://localhost:3000' -H 'accept-encoding: gzip, deflate, br' -H 'accept-language: en-GB,en;q=0.8,en-US;q=0.6,fi;q=0.4' -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36' -H 'accept: /' -H 'referer: http://localhost:3000/' -H 'authority: data-live.flightradar24.com' --compressed

from flightradar24-client.

derhuerst avatar derhuerst commented on June 2, 2024

Can you show me the headers being sent? You can see them in the network inspector, when selecting the request.

from flightradar24-client.

juiceo avatar juiceo commented on June 2, 2024

This is what you're looking for, right?

:authority:data-live.flightradar24.com
:method:GET
:path:/zones/fcgi/feed.js?bounds=53%2C52%2C13%2C14&callback=jsonp&faa=1&flarm=1&mlat=1&adsb=1&air=1&gnd=0&vehicles=0&gliders=0
:scheme:https
accept:/
accept-encoding:gzip, deflate, br
accept-language:en-GB,en;q=0.8,en-US;q=0.6,fi;q=0.4
origin:http://localhost:3000
referer:http://localhost:3000/
user-agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/61.0.3163.100 Safari/537.36

from flightradar24-client.

derhuerst avatar derhuerst commented on June 2, 2024

Apparently your browser still sent the Referer header. Try again with the latest master (faf206b).

from flightradar24-client.

derhuerst avatar derhuerst commented on June 2, 2024

I assume this has been fixed. Please reopen if the issue still persists.

from flightradar24-client.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.