Skip to main content

DNS Configuration

In engineering projects across CRUK, we use the following domains for different environments.

Integration/Preview Domains:

  • Old:

    • app-name.cruk.org
    • app-name.int.cruk.org
  • New:

    • app-name.vercel.app
    • app-name.app.crnet.org

Production Domains:

  • app-name.crnet.org
  • app-name.cancerresearchuk.org

Hosted zones will be required for setting up these domains for AWS services like the API gateway and Amplify. Speak to the infrastructure team within your portfolio if you need CNAME records configured for domains against AWS DNS servers.

CDK Constructs

AWS CDK constructs are available for configuring hosted zones to setup stage, sandbox and preview environments. The snippet below describes how to configure a hosted zone and defines IPv4 and IPv6 records to point to a Cloudfront distribution.

const cfDistribution = new Distribution(
this,
`CfDistribution`,
{
domainNames: [`www.${HOSTED_ZONE_NAME}`],
defaultRootObject: 'index.html',
minimumProtocolVersion: SecurityPolicyProtocol.TLS_V1_2_2021,
sslSupportMethod: SSLMethod.SNI,
}
);

const hostedZone = HostedZone.fromHostedZoneAttributes(
this,
`HostedZone`,
{
hostedZoneId: HOSTED_ZONE_ID,
zoneName: HOSTED_ZONE_NAME,
}
);

const aliasRecord = new ARecord(
this,
`Alias-IPv4`,
{
zone: hostedZone as PublicHostedZone,
target: RecordTarget.fromAlias(new CloudFrontTarget(cfDistribution)),
recordName: prefix,
}
);

new AaaaRecord(this, `Alias-IPv6`, {
zone: hostedZone as PublicHostedZone,
target: RecordTarget.fromAlias(new CloudFrontTarget(cfDistribution)),
recordName: prefix,
});

Other Examples:

Vercel

Vercel requires its own DNS servers configured to enable the use of subdomains. There are two nameservers to be configured in a CNAME record,

  • ns1.vercel-dns.com
  • ns2.vercel-dns.com

After this is configured by the infrastructure team, you will be able to point an existing vercel distribution to the domain in the project settings.

Note that Vercel requires a paid subscription for configuring subdomains with custom CRUK domains. You can still customize the preassigned .vercel.app subdomain for free in every deployment using the Vercel CLI and the command below,

vercel alias set subdomain.vercel.app custom-subdomain.vercel.app --token=_vercel-token_ --scope=cruk

Examples: