Next.js Discord

Discord Forum

How do you handle different API endpoints for SSR and CSR?

Unanswered
Scottish Fold posted this in #help-forum
Open in Discord
Scottish FoldOP
Has anyone else stumbled into this use-case? We have a backend on the same cluster as our Next.js app, and we want it to use the backend's FQDN when launching a request from the browser, and the k8s's internal DNS name when doing SSR.

I've figured out I could do this by setting a NEXT_PUBLIC_ envvar on build-time and changing it for runtime, but it feels not too elegant.

Server Actions are not a possibility right now, sadly

0 Replies