Replies: 1 comment
-
|
I'd recommend using Nginx as a reverse proxy for this. Keep your app built with For local devs who need Your backend devs can use the staging build locally by just setting up their own proxy rules. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Summary
Hi all,
I’m working on a Next.js 16 app that we deploy in Docker to Azure for staging and production. Frontend developers usually run it locally using
localhost:3000, while backend/API developers want to use the remote Docker (staging) deployment locally. Right now, they can’t, because the remote frontend is built with/as the base path, which doesn’t match their local setups.The challenge is that our app needs to run under different base paths depending on the environment:
/appor/app-alt(varies per developer)//In Next.js, the
basePathis baked into the build output, so a build created for one path won’t work correctly under another.Currently, we work around this by creating separate builds with different environment variables and using rewrite rules to route paths like
localhost/app/chatto the local server (and equivalent rules for production). But this doesn’t let backend/API developers use the remote build locally without running into routing and asset issues.I know there are a bunch of workarounds floating around, but I’m not sure which one is the “correct” approach for a setup like ours in 2026. Most of the threads I find are quite old, and I’m wondering if there are better, modern solutions now that Next.js 16 is out.
Has anyone solved a similar issue cleanly? What’s the current best practice for handling multiple environments with varying base paths without rebuilding for each one?
Thanks in advance for any insights!
Additional information
No response
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions