Skip to content

Do not forward API traffic from frontend #8423

@Betree

Description

@Betree

There's a practice in frontend to forward API traffic from /api/* to the API endpoint. We envisioned expanding it at some point as it would play nicely with authentication cookies/authenticated requests: #8315.

However, at this stage, this redirect is causing too many issues for little gains:

  1. Since Vercel charges for the execution time, we'll be billed for 10 seconds of frontend execution if the API takes 10 seconds to reply. Whatever we do, proxying means that we're using resources on the frontend server for all API queries, which does not seem right.
  2. This architecture is making private data traverse a service level (the frontend's backend) that arguably shouldn't be responsible for handling this data.
  3. Since we haven't implemented a generic proxy, it's causing many issues down the road of missing parameters, missing endpoints...etc

Proposed solution

  • In dev/staging frontend, use a full path (https://staging.opencollective.com/api/connected-accounts/...) rather than relative URLs
  • In production, Cloudflare will be handling the reverse proxy mechanism. (current behavior)

Metadata

Metadata

Assignees

Labels

frontendtechnical-debtDeprecated code to migrate and other necessary refactors

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions