2022-04-13 16:53:44 +00:00
|
|
|
const withTM = require("next-transpile-modules")([
|
|
|
|
"@calcom/app-store",
|
|
|
|
"@calcom/prisma",
|
|
|
|
"@calcom/lib",
|
|
|
|
"@calcom/ee",
|
|
|
|
]);
|
2022-03-25 18:37:51 +00:00
|
|
|
|
|
|
|
module.exports = withTM({
|
2022-04-15 15:35:05 +00:00
|
|
|
async headers() {
|
|
|
|
return [
|
|
|
|
{
|
2022-04-30 03:09:54 +00:00
|
|
|
// @note: disabling CORS matching all API routes as this will be a our Public API
|
2022-04-15 17:09:35 +00:00
|
|
|
source: "/api/:path*",
|
2022-04-15 15:35:05 +00:00
|
|
|
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",
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
];
|
|
|
|
},
|
2022-03-23 21:22:57 +00:00
|
|
|
async rewrites() {
|
|
|
|
return [
|
2022-04-30 03:09:54 +00:00
|
|
|
// @note: redirects requests from: "/:rest*" the root level to the "/api/:rest*" folder by default.
|
2022-03-23 21:22:57 +00:00
|
|
|
{
|
|
|
|
source: "/:rest*",
|
|
|
|
destination: "/api/:rest*",
|
|
|
|
},
|
2022-04-30 03:09:54 +00:00
|
|
|
// @note: redirects requests from api/v*/:rest to /api/:rest?version=* passing version as a query parameter.
|
2022-03-23 21:22:57 +00:00
|
|
|
{
|
|
|
|
source: "/api/v:version/:rest*",
|
|
|
|
destination: "/api/:rest*?version=:version",
|
|
|
|
},
|
|
|
|
];
|
|
|
|
},
|
2022-03-25 18:37:51 +00:00
|
|
|
});
|