Skip to content

fix: update headers to bypass Cloudflare 403 Forbidden blocks#97

Open
DimaD16 wants to merge 4 commits intoJeanExtreme002:mainfrom
DimaD16:main
Open

fix: update headers to bypass Cloudflare 403 Forbidden blocks#97
DimaD16 wants to merge 4 commits intoJeanExtreme002:mainfrom
DimaD16:main

Conversation

@DimaD16
Copy link
Copy Markdown

@DimaD16 DimaD16 commented May 1, 2026

Description

This PR addresses the persistent 403 Forbidden errors encountered when using various functions of the library (such as search(), getFlights(), or getFlightDetails()). These errors are caused by FlightRadar24's Cloudflare protection blocking the default browser-based headers.

Root Cause

Cloudflare's security measures currently flag and block the outdated Chrome/Windows 7 User-Agent string used by default in core.js and core.py. This results in the client receiving a "Just a moment..." challenge page or a direct 403 response instead of the requested JSON/data.

Solution

The fix involves updating the global headers in core.js and core.py to mimic the official FlightRadar24 mobile application (iOS). Mobile app traffic is generally subject to different filtering rules and is currently not blocked by the Cloudflare challenges affecting browser-like requests from scripts.

Key Changes:

  • User-Agent: Switched to a valid mobile app string: Flightradar24/10.0.0 (com.flightradar24.iphone; build:10.0.0.1; iOS 17.4.1) Alamofire/5.9.1.
  • Header Cleanup: Removed unnecessary browser-specific headers (origin, referer, sec-fetch-*) that are not used by the mobile API and can serve as bot fingerprints.
  • Global Fix: Since these changes are in the Core class, they automatically apply to all API requests made by the library.

@DimaD16
Copy link
Copy Markdown
Author

DimaD16 commented May 2, 2026

@JeanExtreme002

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant