This content originally appeared on DEV Community and was authored by Manuel de la Torre
I’m writing this post, because Customer.io documentation includes only information for configuring HTTPS links on other platforms but Google Cloud, and I spend like 4 hours figuring out how to solve it.
1. Create your domain in Customer.io
Sign into Customer.io and navigate to Workspace settings
-> Email
and click on Add Sending Domain
. Now create one, for example zenfi.mx
.
Go to the Link Tracking
tab:
There, you can configure your Host name (in this case email.cio
) and you can see the Canonical name (e.customeriomail.com
).
2. Create a GCP Load Balancer
Go to your GCP account, and navigate to Network Services
-> Load balancing
. Click on Create load balancer
.
Choose the following options:
- Type of load balancer:
Application Load Balancer (HTTP/HTTPS)
- Public facing or internal:
Public facing (external)
- Global or single region deployment:
Best for global workloads
- Load balancer generation:
Global external Application Load Balancer
- Click on
Configure
3. Configure a frontend
- Set any name (eg.
email-customer-io
) - Protocol:
HTTPS
- IP version:
IPv4
IMPORTANT IP address: click on
Create IP address
, set a name and copy the created address we’ll need it latter (eg.33.100.10.14
).- Port:
443
- Certificate: click on
Create a new certificate
, write a name and selectCreate Google-managed certificate
.
4. Configure a backend
- Navigate to
Backend configuration
. - Open the dropdown and click on
Create a backend service
. - Write a name (eg.
customer-io
. - Backend type:
Internet network endpoint group
. - Protocol:
HTTPS
. - Backends -> New backend: click on
Create Internet network endpoint group
. It will open a new tab, create a new group with the settings:- Name: write any name (eg.
customer-io
) - Network endpoint group type:
Internet NEG (Global, regional)
. - Scope:
Global
. - Default port:
443
. - Select
Fully qualified domain name and port
and write the Canonical name from the Customer.io panel (eg.e.customeriomail.com
). - Click on
Create
, go back to the previous tabs and select the group you just created.
- Name: write any name (eg.
IMPORTANT Now, open the
Advanced configurations
menu and go toCustom request headers
. Set the following headers:-
cname-api-key
: Use the Canonical name with https (eg.https://e.customeriomail.com
). -
host
: Set your domain name (eg.email.cio.zenfi.mx
).
-
- Finally, click on
Create
.
Custom request headers example:
5. Configure routes
- Navigate to
Routing rules
- Select
Advanced host and path rule
. - Open the default created route.
- Action:
Route traffic to a single backend
. - Backend: select the one you cerated (eg.
customer-io
). IMPORTANT Add on action (URL rewrite): write the Canonical name from the Customer.io panel (eg.
e.customeriomail.com
).- Click on
Done
, and finally click onCreate
to create the load balancer.
6. Configure the DNS
- Navigate to
Network Services
->Cloud DNS
and open your DNS config. - Click on
Add standard
. - Write your the subdomain you configured in Customer.io (eg.
email.cio
). - Resource record type:
A
. - IPv4 Address: Paste the IP you created before (eg.
33.100.10.14
). - Click on
Create
.
Now you are done! GO back to Customer.io and click on Verify domain
to finish your configuration.
Note: It may take a few minutes for the DNS to be propagated and the SSL certificate to be provisioned.
This content originally appeared on DEV Community and was authored by Manuel de la Torre