diff --git a/src/constants/constants.ts b/src/constants/constants.ts index 6ba8ca800..ecabaabb6 100644 --- a/src/constants/constants.ts +++ b/src/constants/constants.ts @@ -77,7 +77,8 @@ export const REDIRECTION_SERVER_IPS = [ "18.139.47.66", ] export const DNS_INDIRECTION_DOMAIN = "hostedon.isomer.gov.sg" -export const DNS_CNAME_SUFFIXES = ["cloudfront.net", "kxcdn.com"] +export const DNS_KEYCDN_SUFFIX = "kxcdn.com" +export const DNS_CNAME_SUFFIXES = ["cloudfront.net", DNS_KEYCDN_SUFFIX] export const DNS_INDIRECTION_REPO = "isomer-indirection" export const ISOMER_ADMIN_EMAIL = "admin@isomer.gov.sg" export const ISOMER_SUPPORT_EMAIL = "support@isomer.gov.sg" diff --git a/support/routes/v2/isobot/ops/botService.ts b/support/routes/v2/isobot/ops/botService.ts index e006eea3f..894ec6e9c 100644 --- a/support/routes/v2/isobot/ops/botService.ts +++ b/support/routes/v2/isobot/ops/botService.ts @@ -9,6 +9,7 @@ import { config } from "@config/config" import { DNS_CNAME_SUFFIXES, DNS_INDIRECTION_DOMAIN, + DNS_KEYCDN_SUFFIX, REDIRECTION_SERVER_IPS, } from "@root/constants" import logger from "@root/logger/logger" @@ -206,7 +207,7 @@ class BotService { const isIntermediateValid = intermediateRecords && ((cnameRecord && - cnameRecord.endsWith(".kxcdn.com") && + cnameRecord.endsWith(`.${DNS_KEYCDN_SUFFIX}`) && intermediateRecords.length === 1) || (intermediateRecords.length === 4 && (isDomainCnameCorrect ||