opencollective-frontend icon indicating copy to clipboard operation
opencollective-frontend copied to clipboard

Set up http-proxy in pages/api/[...proxy]

Open gustavlrsn opened this issue 2 years ago • 4 comments

  • Adding a proxy through http-proxy in pages/api/[...proxy].ts
    • Will retain the API proxy functionality from the custom server, enabling to pass along headers (such as the root redirect cookie)
  • Since it is using a catch all route [...proxy] we can remove all other routes that are set up to proxy things to the API here

gustavlrsn avatar Jan 11 '24 14:01 gustavlrsn

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
opencollective-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 22, 2024 1:46pm
opencollective-styleguide ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 22, 2024 1:46pm

vercel[bot] avatar Jan 11 '24 14:01 vercel[bot]

  • #9882 Graphite 👈
  • main

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @gustavlrsn and the rest of your teammates on Graphite Graphite

gustavlrsn avatar Jan 11 '24 14:01 gustavlrsn

Todo:

  • [x] Remove pages/api/connected-accounts/* routes (should be handled by the catch-all proxy)

gustavlrsn avatar Jan 11 '24 18:01 gustavlrsn

@Betree yep, predefined routes should keep precedence over catch all routes:

Predefined API routes take precedence over dynamic API routes, and dynamic API routes over catch all API routes.

https://nextjs.org/docs/pages/building-your-application/routing/api-routes#caveats

gustavlrsn avatar Apr 30 '24 15:04 gustavlrsn