diff --git a/clients/admin-ui/next.config.js b/clients/admin-ui/next.config.js index 197220561ef..69e075fe980 100644 --- a/clients/admin-ui/next.config.js +++ b/clients/admin-ui/next.config.js @@ -17,6 +17,31 @@ const nextConfig = { */ proxyTimeout: 120000, }, + async rewrites() { + // The tests run without a server. Rewrites cause Next to continually try to connect, + // which spams the logs with "ECONNREFUSED". + if (process.env.NODE_ENV === "test") { + return []; + } + + // these paths are unnecessarily complicated due to our backend being + // picky about trailing slashes https://github.com/ethyca/fides/issues/690 + return [ + { + source: `/api/v1/:path`, + destination: `${process.env.NEXT_PUBLIC_FIDESCTL_API_SERVER}/api/v1/:path/`, + }, + { + source: `/api/v1/:first/:second*`, + destination: `${process.env.NEXT_PUBLIC_FIDESCTL_API_SERVER}/api/v1/:first/:second*`, + }, + // The /health path does not live under /api/v1 + { + source: `/health`, + destination: `${process.env.NEXT_PUBLIC_FIDESCTL_API_SERVER}/health`, + }, + ]; + }, images: { loader: "custom", },