Background
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.
Setup
Generate an SSL Certificate
- Generate an SSL certificate for the domain (i.e. links.YOUR_DOMAIN.com) 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: ELB-linkslb-1505033010
- 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, OPTIONS, PUT, POST, DELETE
- Cache Based on Selected Request 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
- Custom SSL Client Support: Only Clients that Support Server Name Indication (SNI)
- Security Policy: TLSv1.2
- 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 Settings > Mail Domains and add links.YOUR_DOMAIN.com as a tracking domain. Set that tracking domain as default.
- Also be sure to contact support@iterable.com to toggle on the "Use HTTPS".
Confirm correct configuration
- Use the
openssl
command 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.
Deploy
- Set a CNAME record in your DNS settings
- links.[YOUR_DOMAIN].com CNAME [YOUR_CF_URL]
- i.e.: links.mysite.com CNAME d49jhgak555.cloudfront.net
- After about 1 hour, navigating to https://links.mysite.com should redirect to the Iterable app.
Note: If you are using Amazon Route 53, it is possible to use an alias record (A record) instead of a CNAME record as noted in this documentation. If you plan to use an alias record (A record) instead of a CNAME record, you will need to ensure that you are passing through the User-Agent header. This will allow you to track and record device information.
Comments
0 comments
Please sign in to leave a comment.