Scheduling infrastructure for absolutely everyone.
remove headers from next config, add rewrites from hariom pr
Agusti Fernandez Pardo8aa4852b875d
diff --git a/next.config.js b/next.config.jsindex fa5bc84e10a..6122951e9aa 100644--- a/next.config.js+++ b/next.config.js@@ -10,36 +10,28 @@ const withTM = require("next-transpile-modules")([// use something like withPlugins([withTM], {}) if more plugins added later.module.exports = withTM({- async headers() {- return [- {- // matching all API routes- source: "/api/:path*",- headers: [- { key: "Access-Control-Allow-Credentials", value: "true" },- { key: "Access-Control-Allow-Origin", value: "*" },- { key: "Access-Control-Allow-Methods", value: "GET,OPTIONS,PATCH,DELETE,POST,PUT" },- {- key: "Access-Control-Allow-Headers",- value:- "X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version, Content-Type, api_key, Authorization",- },- ],- },- ];- },async rewrites() {- return [- // This redirects requests recieved at / the root to the /api/ folder.- {- source: "/:rest*",- destination: "/api/:rest*",- },- // This redirects requests to api/v*/ to /api/ passing version as a query parameter.- {- source: "/api/v:version/:rest*",- destination: "/api/:rest*?version=:version",- },- ];+ return {+ beforeFiles: [+ // This redirects requests recieved at / the root to the /api/ folder.+ {+ source: "/v:version/:rest*",+ destination: "/api/v:version/:rest*",+ },+ // This redirects requests to api/v*/ to /api/ passing version as a query parameter.+ {+ source: "/api/v:version/:rest*",+ destination: "/api/:rest*?version=:version",+ },+ ],+ fallback: [+ // These rewrites are checked after both pages/public files+ // and dynamic routes are checked+ {+ source: "/:path*",+ destination: `/api/:path*`,+ },+ ],+ };},});