Midnight MarketingDocs

Domains and redirects#

The site has one canonical hostname. This page describes the redirect, why it exists, and what to confirm after a DNS or platform change.

The canonical hostname#

https://deployatmidnight.com is canonical. It is declared in three places that must agree:

Place What it sets
Site metadata The canonical URL, and the base for Open Graph and sitemap URLs
The request worker The hostname comparison that drives the redirect
DNS and the hosting platform Which hostnames actually reach the service

The www redirect#

A request whose hostname is www.deployatmidnight.com is redirected to the same path on the apex, over HTTPS, with status 308.

Two details matter:

  • 308, not 301 or 302. A permanent redirect that preserves the request method, so a client that follows it keeps its method and body.
  • The protocol is forced to HTTPS. A plaintext request to the www hostname is redirected to the secure apex rather than to a plaintext URL, so the redirect never hands a client back to an insecure address.

Every other hostname is served as it arrives. The redirect matches one exact hostname rather than a pattern, so a new hostname pointed at the service is not redirected until it is added deliberately.

After a DNS or platform change#

  1. Confirm the apex resolves and serves the site.
  2. Confirm the www hostname resolves and returns 308 to the apex.
  3. Confirm the canonical URL in the page source still names the apex.
curl -sSI https://www.deployatmidnight.com/

Verify#

  • The apex returns 200.
  • www returns 308 with Location: https://deployatmidnight.com/.
  • npm test passes locally, which covers the redirect logic itself.

If it does not work#

Symptom Check Recovery
www returns 200 instead of redirecting Whether something ahead of the worker serves that hostname Check the platform's own domain and redirect settings
www redirects to a plaintext URL Whether the deployed worker is current The shipped worker forces HTTPS; confirm the deployment is current
Redirect loop Whether the apex also matches the redirect condition Confirm the hostname comparison names only the www hostname
Certificate warning on www Whether the certificate covers that hostname Issue or extend the certificate to cover both names before relying on the redirect