Skip to main content

2 posts tagged with "devops"

View All Tags

Codifying scotthavird.com in Terraform

· 5 min read
Scott Havird
Engineer at Georgia-Pacific · ex-WarnerMedia Innovation Lab (ContentAI) · decade shipping AI-powered platforms

Codifying scotthavird.com in Terraform​

For years this site lived in two places at once: the Docusaurus repo and a scattering of Cloudflare dashboard clicks. Pages project settings, custom domains, zone security toggles, and an email signup API that only existed in AWS — none of it was reviewable in a PR.

That drift is fine until it isn't. I hit the www redirect trap on my own domain. Preview builds failed because Node 18 was still configured in the dashboard while Docusaurus 3.9 requires Node 20. Each fix was another manual change with no audit trail.

So I codified the whole stack in iac/ and retired the GitHub Actions deploy workflow in favor of native Cloudflare Pages builds.

TL;DR

Moved scotthavird.com infrastructure into Terraform: Cloudflare Pages (build + env vars), zone security (SSL strict, HSTS preload), DNS for SES, and an AWS Lambda subscribe API wired into the Docusaurus build via SUBSCRIBE_API_URL. Dashboard-only config is now PR-reviewable.

Your Cloudflare Pages Redirect Is Probably Backwards

· 9 min read
Scott Havird
Engineer at Georgia-Pacific · ex-WarnerMedia Innovation Lab (ContentAI) · decade shipping AI-powered platforms

Your Cloudflare Pages Redirect Is Probably Backwards​

Here's a scenario that's more common than it should be: you set up a site on Cloudflare Pages, configure a redirect so that www points to your apex domain, and everything looks fine. Then six months later you check Google Search Console and your impressions are split across four different URL variants. Half your SEO equity is leaking because both www.yourdomain.com and yourdomain.com are being indexed as separate pages.

The culprit isn't your code. It's Cloudflare Pages silently redirecting your apex domain to www — the exact opposite of what you intended.

I ran into this on my own site and spent longer than I'd like to admit tracing it down. Here's exactly what happens and how to fix it permanently.

TL;DR

Cloudflare Pages silently flips the www-vs-apex redirect based on which domain you added first. This post walks through the diagnosis with curl, why the Rulesets API cannot fix it, and the Page Rule plus proxied A-record combination that codifies the correct canonical in Terraform.