Phanpy sends large numbers of OPTIONS HTTP requests when making Mastodon API calls
- Dominant language
- JavaScript
- Stars
- 1.5k
- Forks
- 186
- Avg merge
- 1d 36m
- Merged PRs (30d)
- 11
Description
**Describe the bug**
- Which site: phanpy.social
- Which site version: 2024.07.01.5e9165b
- Which instance: princess.industries (running GotoSocial 0.17-dev)
**To Reproduce**
1. Open browser dev tools or an HTTP proxy tool. Filter to XHR if possible.
2. Open Phanpy.
3. Interact with the app: scroll the timeline, view a thread, view a user, etc.
4. See about one `OPTIONS` request before almost any other API call HTTP request.
**Expected behavior**
Phanpy should not send so many `OPTIONS` requests. This causes unnecessary network traffic and unnecessary work for the server, and might result in Phanpy (and other clients sharing the same IP, including other Phanpy instances) getting rate limited.
**Screenshots**

**Desktop:**
- OS: macOS 14
- Browser: Firefox
- Version: 127.0.2
**Additional context**
I'm guessing this is part of Mastodon API feature detection, but it shouldn't be necessary to preflight literally every API route. Even caching the results for a given API route for a few minutes would help a lot.
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the report using browser developer tools or an HTTP proxy while scrolling the timeline, viewing a thread, and viewing a user. Trace the Mastodon API requests and their OPTIONS requests; done means normal API interactions no longer generate an unnecessary preflight before almost every call without breaking those requests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100