From 1a0a318a552c5aeb321e2eef3468c2feea2559f7 Mon Sep 17 00:00:00 2001 From: zomars Date: Thu, 14 Jul 2022 14:56:00 -0600 Subject: [PATCH] Revert "Adds custom rewrite logic for hosted cal.com" This reverts commit 9e5b1f121f0a6d404810cf960d901029b596517f. # Conflicts: # apps/web/next.config.js --- apps/web/next.config.js | 76 ++++++++--------------------------------- 1 file changed, 14 insertions(+), 62 deletions(-) diff --git a/apps/web/next.config.js b/apps/web/next.config.js index ba77dd99ab..688cd7060d 100644 --- a/apps/web/next.config.js +++ b/apps/web/next.config.js @@ -84,68 +84,20 @@ const nextConfig = { return config; }, async rewrites() { - const rewrites = { - beforeFiles: [], - afterFiles: [ - { - source: "/:user/avatar.png", - destination: "/api/user/avatar?username=:user", - }, - { - source: "/team/:teamname/avatar.png", - destination: "/api/user/avatar?teamname=:teamname", - }, - // TODO: We can expose these rewrites in packages/app-store/*.generated.ts - { - source: "/forms/:formId", - destination: "/apps/routing_forms/routing-link/:formId", - }, - /* TODO: have these files being served from another deployment or CDN { - source: "/embed/embed.js", - destination: process.env.NEXT_PUBLIC_EMBED_LIB_URL?, - }, */ - ], - fallback: [], - }; - - /** This logic es specific for our `cal.com` hosted version */ - if (process.env.NEXT_PUBLIC_WEBAPP_URL === "https://app.cal.com") { - const CAL_WEBSITE_SUBDOMAIN_URL = "https://website.cal.com"; - /* Homepage should go to website.cal.com */ - rewrites.beforeFiles.push([ - { - source: "/", - has: [ - { - type: "header", - key: "referer", - value: `${process.env.NEXT_PUBLIC_WEBSITE_URL}/`, - }, - ], - destination: `${CAL_WEBSITE_SUBDOMAIN_URL}/`, - }, - { - source: "/_next/static/:static*", - has: [ - { - type: "header", - key: "referer", - value: `${process.env.NEXT_PUBLIC_WEBSITE_URL}/`, - }, - ], - destination: `${CAL_WEBSITE_SUBDOMAIN_URL}/_next/static/:static*`, - }, - ]); - /* Everything else should fallback to website.cal.com */ - rewrites.fallback.push([ - { - source: "/:websitePage*", - destination: CAL_WEBSITE_SUBDOMAIN_URL + "/:websitePage*", - }, - ]); - } - - return rewrites; + return [ + { + source: "/:user/avatar.png", + destination: "/api/user/avatar?username=:user", + }, + { + source: "/team/:teamname/avatar.png", + destination: "/api/user/avatar?teamname=:teamname", + }, + /* TODO: have these files being served from another deployment or CDN { + source: "/embed/embed.js", + destination: process.env.NEXT_PUBLIC_EMBED_LIB_URL?, + }, */ + ]; }, async redirects() { const redirects = [