Skip to content

Conversation

@dhairyashiil
Copy link
Member

What does this PR do?

Fixes incorrect bookingUrl field returned by api.cal.eu/v2/event-types for non-organization users.

Problem

  • EU API returns https://cal.com/user/event instead of https://app.cal.eu/user/event
  • cal.eu redirects to marketing page, not booking pages
  • Bookings are served from app.cal.eu

Solution

Updated getOrgFullOrigin() to detect when WEBSITE_URL and WEBAPP_URL are on different root domains. When they differ (EU case), use WEBAPP_URL instead.

Deployment WEBAPP_URL WEBSITE_URL Result
US app.cal.com cal.com cal.com/user/event
EU app.cal.eu cal.com app.cal.eu/user/event

Changes

  • packages/features/ee/organizations/lib/orgDomains.ts - Updated getOrgFullOrigin() logic
  • packages/features/ee/organizations/lib/orgDomains.test.ts - Added EU test case

Type of change

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

How should this be tested?

  1. Run yarn test packages/features/ee/organizations/lib/orgDomains.test.ts - all 10 tests pass
  2. After deployment to EU, verify GET api.cal.eu/v2/event-types returns correct bookingUrl

For EU deployments where WEBAPP_URL (app.cal.eu) differs from
WEBSITE_URL (cal.com), use WEBAPP_URL for non-org booking URLs.
This fixes incorrect bookingUrl in API responses for EU instance.
@graphite-app graphite-app bot added the community Created by Linear-GitHub Sync label Jan 20, 2026
@dhairyashiil dhairyashiil enabled auto-merge (squash) January 20, 2026 10:42
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Copy link
Contributor

@supalarry supalarry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Request to re-use code:

return options.protocol ? WEBSITE_URL : WEBSITE_URL.replace("https://", "").replace("http://", "");
if (!slug) {
// Use WEBAPP_URL if domains differ (e.g., EU: app.cal.eu vs cal.com)
const getBaseDomain = (hostname: string) => hostname.split(".").slice(-2).join(".");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The logic for const getBaseDomain is copied from getTldPlus1 function (search for it in vs code).

We already have 2 copies of getTldPlus1 - can we define it only once and re-use it in the 2 existing places and here and get rid of copies?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the review, made following changes:

  1. created packages/lib/getTldPlus1.ts - new shared utility
  2. updated getSafeRedirectUrl.ts - removed inline copy, now imports shared function
  3. updated orgDomains.ts - uses shared getTldPlus1 instead of inline getBaseDomain

@github-actions github-actions bot marked this pull request as draft January 20, 2026 11:32
auto-merge was automatically disabled January 20, 2026 11:32

Pull request was converted to draft

@pull-request-size pull-request-size bot added size/M and removed size/S labels Jan 20, 2026
@dhairyashiil dhairyashiil marked this pull request as ready for review January 20, 2026 12:17
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 4 files

Copy link
Contributor

@supalarry supalarry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

@dhairyashiil dhairyashiil enabled auto-merge (squash) January 20, 2026 12:41
@dhairyashiil dhairyashiil merged commit bea542b into main Jan 20, 2026
82 of 83 checks passed
@dhairyashiil dhairyashiil deleted the fix/eu-booking-url branch January 20, 2026 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community Created by Linear-GitHub Sync ready-for-e2e size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants