Written for: For administrators
Serve Astrato on your own domain
A custom domain lets people open Astrato at a host name you own, such as analytics.example.com,
instead of app.astrato.io. You run a reverse proxy on that host name in your own cloud account.
The proxy forwards every request to app.astrato.io and tells Astrato, in the X-Forwarded-Host
header, which host name the request arrived on.
There is no setting for a custom domain in Administration. You set up the proxy, then Astrato support enables the domain.
A custom domain is not the same as either of these settings:
- the Allow list on Administration → Embed Links, which lists the sites that may embed Astrato content in their own pages. See Manage embed links.
- Administration → Content Security Policy, which lists the sites whose content may load inside Astrato. See Manage Content Security Policy origins.
To show Astrato inside your own web app rather than at your own host name, see Embed an Astrato dashboard in your web app.
Before you start
Section titled “Before you start”You need:
- a host name you control, and access to its DNS records;
- an account with a cloud provider that can run an HTTPS reverse proxy, such as AWS or Google Cloud;
- a TLS certificate for the host name, or a way to request one from your provider.
What the proxy must do
Section titled “What the proxy must do”Whichever provider you use, configure the proxy so that it:
- serves your host name over HTTPS, with a certificate for that name;
- forwards every request to
app.astrato.ioon port 443 over HTTPS; - sends the
HostandX-Forwarded-Hostheaders set to your host name, such asanalytics.example.com; - passes all HTTP methods, all cookies and all query strings through unchanged;
- does not cache responses.
The two sections below show one way to do this on AWS and on Google Cloud. Any proxy that meets the list above works the same way.
Set up AWS CloudFront
Section titled “Set up AWS CloudFront”- In AWS Certificate Manager, request a public certificate for your host name in the
us-east-1region. CloudFront uses certificates from that region only. - Create a CloudFront distribution with a custom origin of
app.astrato.io, protocol HTTPS only. Add a custom origin headerX-Forwarded-Hostset to your host name. - On the default cache behaviour, set:
- Viewer protocol policy: Redirect HTTP to HTTPS or HTTPS Only. With HTTP and HTTPS, people can reach Astrato over plain HTTP. Use the same setting on every cache behaviour.
- Allowed HTTP methods: all methods, including
POST,PUT,PATCHandDELETE. - Cache policy: the managed CachingDisabled policy.
- Origin request policy: one that forwards the
Hostheader, all cookies and all query strings.
- Add your host name as an Alternate domain name and choose the certificate from step 1.
- In DNS, create a CNAME record for your host name that points to the distribution’s domain
name, such as
d111111abcdef8.cloudfront.net. In Route 53 you can use an alias record instead.
AWS describes these settings in Using custom origins, Cache behavior settings and Requirements for using alternate domain names.
Keep the distribution’s domain name; support asks for it.
Set up a Google Cloud load balancer
Section titled “Set up a Google Cloud load balancer”- Reserve a global static external IP address.
- Create an Internet network endpoint group with the fully qualified domain name
app.astrato.ioon port 443. - Create a backend service that uses the endpoint group, with protocol HTTPS and Cloud CDN off.
Add two custom request headers,
HostandX-Forwarded-Host, both set to your host name. - Create a global external Application Load Balancer with an HTTPS frontend on port 443, on the reserved address, with a certificate for your host name, routing to the backend service.
- In DNS, point your host name at the reserved address.
Google describes Internet network endpoint groups in Internet NEGs overview.
Keep the reserved IP address; support asks for it.
Ask Astrato support to enable the domain
Section titled “Ask Astrato support to enable the domain”When the proxy is running, contact Astrato support with:
- your full host name, including any prefix, such as
analytics.example.com; - for CloudFront, the distribution’s domain name, such as
d111111abcdef8.cloudfront.net; - for Google Cloud, the load balancer’s public IP address.
When support confirms the domain is enabled, open https:// followed by your host name in a
browser and sign in.