import type { NextConfig } from "next"; /* * This app proxies nothing. * * /api, /auth, /install, /update and /public are the Go server's, and routing * them there is the reverse proxy's job - the same proxy that already * terminates TLS in front of this process. Next used to rewrite them itself * from an API_URL naming the control plane, which meant every deployment had * two possible request paths for the same URL and one environment variable * that silently broke a whole prefix when it named the wrong host: pointed at * the marketing site, /public/status/... 404'd as a page that does not exist, * indistinguishable from a status page that does not exist. * * Browser calls are same-origin and relative (see lib/api.ts), and the public * status page's server-side fetch is made against the visitor's own host, so * nothing in this app needs to know the control plane's address any more. */ const nextConfig: NextConfig = { output: "standalone", async redirects() { return [ { // The API keys page briefly lived at /api-keys, which every // raw-prefix proxy in front of this app captures with its /api // rule - nginx's `location /api` matches /api-keys, so the // request reached the Go server and 404'd. The page is at // /tokens now precisely because that cannot happen to it. source: "/api-keys", destination: "/tokens", permanent: true, }, ]; }, }; export default nextConfig;