77 ms·
My favorite way to avoid preflights is to have Next.js handle the reverse proxy. It fits my mental model better to have it code-side instead of putting Cloudfl
by colinclerk 5y ago
My favorite way to avoid preflights is to have Next.js handle the reverse proxy. It fits my mental model better to have it code-side instead of putting Cloudflare/Fastly in front.
- deleted 5y ago[deleted]
- smt88 5y agoThat does avoid preflight, but it just adds additional requests for all static assets. It seems like it's just trading one type of overhead for another.
- crooked-v 5y agoI do this enough that I really had Next had some config-level handling for API reverse proxy stuff instead of writing a /api wrapper for each.
- colinclerk 5y agoCheck out “rewrites”: https://nextjs.org/docs/api-reference/next.config.js/rewrites https://nextjs.org/docs/api-reference/next.config.js/rewrite...