cal.com icon indicating copy to clipboard operation
cal.com copied to clipboard

[CAL-3415] WARNorgDomains.ts Match of WEBAPP_URL with ALLOWED_HOSTNAME failed

Open mabdelfattah opened this issue 1 year ago • 14 comments

Latest cal version on Docker.

Server logs:

WARNorgDomains.ts Match of WEBAPP_URL with ALLOWED_HOSTNAME failed {
   WEBAPP_URL: 'https://cal.mydomain.com',
   ALLOWED_HOSTNAMES: [
       [
           'cal.mydomain.com'
    ]
  ]
}

.env File

ALLOWED_HOSTNAMES='["cal.mydomain.com"]'
NEXT_PUBLIC_WEBAPP_URL=https://cal.mydomain.com

UPDATED: I updated the .env File to the following, and I can no more see the warning

ALLOWED_HOSTNAMES='"mydomain.com"'
NEXT_PUBLIC_WEBAPP_URL=https://cal.mydomain.com

CAL-3415

mabdelfattah avatar Nov 02 '23 12:11 mabdelfattah

Thank you for opening your first issue, one of our team members will review it as soon as it possible. ❤️🎉

github-actions[bot] avatar Nov 02 '23 12:11 github-actions[bot]

I noticed the same failed match on my domain, but when I use the following: ALLOWED_HOSTNAMES='"mydomain.com"' NEXT_PUBLIC_WEBAPP_URL=https://cal.mydomain.com I get a 404 error: image

jabertech avatar Nov 29 '23 15:11 jabertech

I also see this error

mturilin avatar Dec 08 '23 19:12 mturilin

same error here

leguennecj avatar Jan 25 '24 14:01 leguennecj

Thanks for your update, this error no longer appear.

However now, I get redirect to http://localhost:3000 after login

drajabr avatar Feb 01 '24 09:02 drajabr

I'm having the same issue when trying to visit my public page.

Screenshot 2024-02-18 at 00 48 06 Screenshot 2024-02-18 at 00 54 12

Allowed hostnames is properly defined in .env: ALLOWED_HOSTNAMES='"mydomain.com"'

Krislunde avatar Feb 17 '24 14:02 Krislunde

There might be a problem if the hostname is under a subdomain, see https://github.com/calcom/cal.com/blob/b38807cb0f9cc024f4b614d1cb631245bb95117e/packages/features/ee/organizations/lib/orgDomains.ts#L38

subdomain will never match here becuase of the dot

lubomirblazekcz avatar Feb 22 '24 12:02 lubomirblazekcz

There might be a problem if the hostname is under a subdomain

That seems like a likely culprit. I was indeed trying to host under book.mydomain.com. Unfortunately I already just went for a free account with embedding instead of hosting it myself - so can't quickly test.

Krislunde avatar Feb 26 '24 02:02 Krislunde

I have the same problem with the same situation (subdomain)

olivierlambert avatar Feb 26 '24 09:02 olivierlambert

I am also having the same issues on two deployments all under book.mydomain.com

dantosXD avatar Feb 28 '24 17:02 dantosXD

There might be a problem if the hostname is under a subdomain, see

https://github.com/calcom/cal.com/blob/b38807cb0f9cc024f4b614d1cb631245bb95117e/packages/features/ee/organizations/lib/orgDomains.ts#L38

subdomain will never match here becuase of the dot

You are right, thanks! @zomars @PeerRich could you have a look at it?

Using a 1 level upper the used domain breaks all schedule pages... so it cannot just be left like that.

image

sneko avatar Feb 29 '24 11:02 sneko

@zomars Is this a known issue that is being worked on?

Krislunde avatar Mar 01 '24 00:03 Krislunde

@zomars @PeerRich Should we reopen this issue? If it's something separate I can create a new issue.

andr-ec avatar Mar 01 '24 23:03 andr-ec

I am also hosting under a subdomain and having this issue. Deploying to a subdomain is pretty popular in the self-hosting community so hope to see this addressed soon!

Thanks for the great software.

axsuul avatar May 01 '24 01:05 axsuul

I'm joigning the rank of the people having the same issue, under the same condition apparently (self-hosted on a subdomain). I've tried many: WEBAPP_URL: 'https://cal.domain.tld'

ALLOWED_HOSTNAMES: [
@calcom/web:start:     [
@calcom/web:start:       'https://cal.domain.tld',
@calcom/web:start:       'cal.domain.tld',
@calcom/web:start:       'cal.com',
@calcom/web:start:       'cal.dev',
@calcom/web:start:       'cal-staging.com',
@calcom/web:start:       'cal.community',
@calcom/web:start:       'cal.local:3000',
@calcom/web:start:       'localhost:3000'
@calcom/web:start:     ]
@calcom/web:start:   ]

as per the .env.example provided.

All resulting in the same error: WARNorgDomains.ts Match of WEBAPP_URL with ALLOWED_HOSTNAME failed

SamAmann avatar Sep 10 '24 12:09 SamAmann

I'm joigning the rank of the people having the same issue, under the same condition apparently (self-hosted on a subdomain). I've tried many: WEBAPP_URL: 'https://cal.domain.tld'

This is the worst project I tinkered with for self-hosting, I already ditched it. It's probably meant to be anti-self-hosted. Sad thing is this behavior only affect poor enthusiasts, as I believe someone with enough money can hire a dev to fix it for their own benefit.

drajabr avatar Sep 11 '24 13:09 drajabr

Same boat as well. Same issues.

siddharthalodha avatar Sep 16 '24 11:09 siddharthalodha

First of all sorry about the delay here, somehow I missed this ticket 🙏

It seems like a configuration and expectations issue to me. Cal.com supports organization with subdomains only at the moment.

ALLOWED_HOSTNAMES holds a list of domains, on the subdomains of which the booking links and dashboard would work.

So, if ALLOWED_HOSTNAMES='"cal.com", "cal.dev"' then, acme.cal.com is a valid organization booking domain and WEBAPP_URL can be set to http://app.cal.com dunder.cal.dev is also a valid organization subdomain and WEBAPP_URL can be set to http://app.cal.dev

If ALLOWED_HOSTNAMES='"cal.domain.tld"" then WEBAPP_URL should be app.cal.domain.tld and acme.cal.domain.tld, dunder.cal.domain.tld, xxxx.cal.domain.tld are valid domains.

Also, to get organizations working please follow https://github.com/calcom/cal.com/blob/main/packages/features/ee/organizations/README.md#app-setup

Though I realize that we need to improve the DX here with better documentation and simplifying things more. Expect improvements soon !!

hariombalhara avatar Sep 28 '24 14:09 hariombalhara

So, if ALLOWED_HOSTNAMES='"cal.com", "cal.dev"' then, acme.cal.com is a valid organization booking domain and WEBAPP_URL can be set to http://app.cal.com dunder.cal.dev is also a valid organization subdomain and WEBAPP_URL can be set to http://app.cal.dev

If ALLOWED_HOSTNAMES='"cal.domain.tld"" then WEBAPP_URL should be app.cal.domain.tld and acme.cal.domain.tld, dunder.cal.domain.tld, xxxx.cal.domain.tld are valid domains.

Thanks for the reply. If I understand this correctly then the following shouldn't show up?

@calcom/web:start: 08:47:32:454 WARNorgDomains.ts Match of WEBAPP_URL with ALLOWED_HOSTNAME failed {
@calcom/web:start:   WEBAPP_URL: 'https://calendar.convertain.com',
@calcom/web:start:   ALLOWED_HOSTNAMES: [
@calcom/web:start:     [
@calcom/web:start:       'convertain.com',
@calcom/web:start:       'convertain.dev'
@calcom/web:start:     ]
@calcom/web:start:   ]
@calcom/web:start: }

If I set NEXT_PUBLIC_WEBAPP_URL just to calendar.convertain.com without the HTTPS in the Docker settings then I don't get the app to run at all because of...

+ scripts/replace-placeholder.sh http://localhost:3000 calendar.convertain.com
Replacing all statically built instances of http://localhost:3000 with calendar.convertain.com.

RauchenwaldC avatar Sep 30 '24 08:09 RauchenwaldC

@hariombalhara In the Organization setup instructions, we have to enable Organizations in the web app before we can use them. But we can't access the web app because organizations aren't enabled.

Therefore, I can't host Cal on a subdomain from the start. It's a classic catch-22: I need organizations, but can't enable them. Can you confirm this interpretation or offer a work around? Thanks so much! I deeply appreciate your work.

Edit: and 'Organizations' requires an EE license. Hm... what's the recommended self hosting solution then? Can I use Cloudflare tunnels to host it on mydomain.com/cal instead of cal.mydomain.com?

KastanDay avatar Oct 01 '24 17:10 KastanDay

I'll add to this, I have two instances one with a reverse proxy at localhost that does not work and has the same error everyone else is describing

However I have another setup with a reverse proxy on a different server, both of which use caddy.

Oddy enough, the one with the DIFFERENT server running the reverse proxy, appears to work with a subdomain and https without fail.

JackPala avatar Oct 01 '24 19:10 JackPala

@RauchenwaldC Based on what you've posted, it indeed seems like the warning should be gone.

We are working on improvements to orgs setups, domain config, Dockerization, etc. at the moment so will report back here with updates over the coming days/weeks. Appreciate your all's patience and understanding.

keithwillcode avatar Oct 03 '24 11:10 keithwillcode