Currently, Mailgun doesn't officially support HTTPS tracking links. Not to worry though - there is a workaround! It does require the use of a CDN, and we recommend utilizing CloudFlare. However - most CDNs should suffice.
Why Do I Need a CDN?
To understand why the use of a CDN is required for HTTPS tracking links, here's a quick, high-level overview of how they work is needed.
Tracking links work by utilizing a CNAME that points to mailgun.org. Links in your email messages are then rewritten with this tracking hostname. When your recipients then click on those links, it first sends the request to mailgun.org, and we return a redirect to the original URL.
Since we do not support HTTPS connections to mailgun.org, a CDN is needed to fill the gap between the client and mailgun.org. Essentially, the client connects to the CDN via HTTPS, the CDN connects to mailgun.org via HTTP, and the CDN relays the response from mailgun.org to the client over HTTPS.
The following are the specific steps for setting up CloudFlare as a CDN to handle Mailgun tracking links to support HTTPS.
Step 1 - Create a CNAME
In your CloudFlare account:
- Click on the DNS option and configure a new CNAME entry that points your Mailgun Tracking CNAME (e.g., email.your-domain.com) to mailgun.org. Ensure that the CNAME is configured as DNS and HTTP Proxy (CDN). The cloud image under Status should be the color orange.
Step 2 - Create a Page Rule
- Navigate to the Page Rules settings for your domain and create a Page Rule for your Tracking CNAME (i.e., email.your-domain.com) setting SSL to Flexible. Make sure to use a wildcard after your domain for the best results (e.g., https://email.your-domain.com/*).
- Turn this to On.
Step 3 - Create a Support Ticket
Once the above 2 steps are done, create a Support ticket via the Support tab of the Mailgun control panel to let us know. We will then set your links to default to HTTPS instead of HTTP.
Note: CloudFlare's default universal SSL certificate only supports root and 1st level subdomains. If your tracking hostname is a 2nd level domain or higher, you'll need to contact CloudFlare to discuss your options for an SSL certificate to support the tracking hostname.
If any questions arise, just reach out to our Support team via the Support option in your Mailgun control panel!