This tutorial will cover how to configure HSTS-compatible click tracking, meaning links.[YOUR_DOMAIN].com go through SSL/TLS. https://links.[YOUR_TOP_LEVEL_DOMAIN].com needs to reroute to https://links.iterable.com, where we set cookies on the URL for tracking purposes before redirecting back to your domain.
The reason for this setup is that links.iterable.com lives behind an AWS ELB. Currently the only way to support SSL on ELB is via a custom CloudFront Distribution, because it supports SNI and is able to proxy dynamic content to any origin server. Another option might be a server-less API Gateway + Lambda setup, but that won't be explored in this tutorial.
Generate an SSL Certificate
- Generate an SSL certificate for the domain which you want to CNAME to links.iterable.com. We recommend doing this through AWS Certificate Manager due to the convenience, but you can use another service as well. You can learn about how to do that here.
- Continue to the next step once you've approved the certificate
Create a new CloudFront Distribution
- Go to https://console.aws.amazon.com/cloudfront/ and click “Create Distribution”
- Select “Web” as your delivery method
- Origin Settings
- Origin Domain Name: links.iterable.com
- Origin Path: leave blank
- Origin ID: Custom-links.iterable.com
- Origin SSL Protocols: check all but SSLv3 (don't select this due to POODLE vulnerability) (default)
- Origin Protocol Policy: HTTPS Only
- HTTP Port: 80 (default)
- HTTPS Port: 443(default)
- Default Cache Behavior
- If using Iterable's unsubscribe page, allow POST as well (otherwise resubscribe requests from the page will fail)
- Viewer Protocol Policy: HTTP and HTTPS (default)
- Allowed HTTP Methods: GET, HEAD (default)
- Forward Headers: All
- Object Caching: Use Origin Cache Headers
- Minimum TTL: 0 (default)
- Maximum TTL: 31536000 (default)
- Default TTL: 86400
- Forward Cookies: All
- Query String Forwarding and Caching: Forward all, cache based on all
- Smooth Streaming: No (default)
- Restrict Viewer Access: No (default)
- Lambda Function Associations: leave blank
- Distribution Settings
- Choose the certificate that you created through ACM or through another service
- Price Class: Use All Edge Locations (default)
- AWS WAF Web ACL: None (default)
- Alternate Domain Names (CNAMEs): links.[YOUR_DOMAIN].com (i.e. links.mysite.com)
- SSL Certificate: Custom SSL Certificate
- Supported HTTP Versions: HTTP/2, HTTP/1.1, HTTP/1.0 (default)
- Default Root Object: leave blank
- Logging: Off (default)
- Bucket for Logs: leave blank
- Log Prefix: leave blank
- Cookie Logging: Off (default)
- Enable IPv6: Enable
- Distribution State: Enabled (default)
- Click “Create Distribution” once everything looks good.
- Wrap up
- On the “CloudFront Distributions” page, you should see your distribution in an “In Progress” status with a spinning arrow.
- Once that changes to “deployed”, copy the URL of your CloudFront distribution from “Domain Name” under the “General” tab of your distribution. You will need this for the “Deploy” step.
- Go to https://app.iterable.com/settings/mailDomains and add links.YOUR_DOMAIN.com as a tracking domain. Also be sure to toggle "Use HTTPS" on, and set that tracking domain as default.
Confirm correct configuration
- Use the
opensslcommand line tool to confirm correct configuration
openssl s_client -servername [CNAME] -connect [CLOUDFRONT_DISTRO_URL]:443
- If you don't see an output that contains your certificate, double-check your CloudFront Distribution settings.