I’m deploying a Vite SPA to Vercel, and my backend is deployed elsewhere. Vercel’s rewrites feature is handy to allow proxying /api/* to my backend api url, but I don’t want to commit my backend address to source control.
I’m working around this issue by writing the vercel.json as part of my Github Action:
I see what you mean. But, there is no other way to dynamically generate a vercel.json.
I’m curious to know why you want to keep your backend API as a secret because the frontend users will always know what the backend API url is. So, the URL itself is a public information anyways.
@anshumanb the rewrites feature allows me to hide the backend API url from frontend users.
Lets say my backend API was https://example.com. With rewrites, the frontend users will see a call to /api/foo, which will be proxied to https://example.com/foo via Vercel rewrites. Does that make sense?
Hi @hpx7, thanks for explaining your use case. But as of today, we don’t have other way to support dynamic values in the vercel.json file. So, the solution you are using is the ideal one.