You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Next.js Server Components require absolute URLs to fetch data (http://...),
while client-side code needs relative URLs to avoid CORS issues in
containerized deployments.
Currently, the code uses a single URL that breaks when deployed in containers
or multi-host setups.
Solution
Formalize a pattern for Client vs Server API URLs with:
Different environment variables for each context
Helper utilities to get the correct URL based on context
Documentation on how to configure for different deployment scenarios
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Problem
Next.js Server Components require absolute URLs to fetch data (http://...),
while client-side code needs relative URLs to avoid CORS issues in
containerized deployments.
Currently, the code uses a single URL that breaks when deployed in containers
or multi-host setups.
Solution
Formalize a pattern for Client vs Server API URLs with:
Example
Impact
Makes containerized deployments easier, supports multi-host setups,
improves developer experience.
See: #515 (Your PR reference)
Beta Was this translation helpful? Give feedback.
All reactions