fix: 404 booking pages when org support is enabled locally

## What does this PR do?
Fix 404 booking pages when org support is enabled locally

## Type of change

<!-- Please delete bullets that are not relevant. -->

- Bug fix (non-breaking change which fixes an issue)

## How should this be tested?

<!-- Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration -->

-  Add localhost:3000 to ALLOWED_HOSTNAMES which is the default recommendation for enabling org support locally.
<img width="1035" alt="Screenshot 2023-07-10 at 11 04 35 AM" src="https://github.com/calcom/cal.com/assets/1780212/7272437b-afae-4073-905b-eafc39f9fafc">
- Simply restart the server and visit http://localhost:3000/pro. It will give 404. After this change it would work

## Mandatory Tasks

- [x] Make sure you have self-reviewed the code. A decent size PR without self-review might be rejected.
This commit is contained in:
Hariom Balhara authored and GitHub committed 2023-07-10 12:19:33 -07:00
1 parent 79944dfed1
commit c2996cd2f8
3 files changed
+18 -1

No files matched your search

+6 -1
View File
@@ -172,9 +172,10 @@ describe("next.config.js - RegExp", () => {
});
describe("next.config.js - Org Rewrite", () => {
// RegExp copied from next.config.js
const orgHostRegExp = (subdomainRegExp: string) =>
// RegExp copied from pagesAndRewritePaths.js orgHostPath. Do make the change there as well.
new RegExp(`^(?<orgSlug>${subdomainRegExp})\\..*`);
describe("Host matching based on NEXT_PUBLIC_WEBAPP_URL", () => {
it("https://app.cal.com", () => {
const subdomainRegExp = getSubdomainRegExp("https://app.cal.com");
@@ -186,6 +187,10 @@ describe("next.config.js - Org Rewrite", () => {
expect(
orgHostRegExp(subdomainRegExp).exec("org.cal.com")?.groups?.orgSlug
).toEqual("org");
expect(
orgHostRegExp(subdomainRegExp).exec("localhost:3000")
).toEqual(null);
});
it("app.cal.com", () => {