Brian Strickland

ServiceNow Platform Manager | Product Owner | AI Enthusiast | Developer | CISSP

Fixed Non-WWW Redirects Using Cloudflare on Azure Static Web Apps

July 20, 2025

I ran into an issue where cyberreadykids.com/thelink would fail, even though the base URL cyberreadykids.com redirected properly to www.cyberreadykids.com. Since I’m hosting my static site using Hugo on Azure Static Web Apps and using GoDaddy for domain registration, the issue came down to path handling and SSL.

The Problem

GoDaddy’s default forwarding doesn’t preserve paths — it only forwards the root domain. So cyberreadykids.com would redirect, but anything like /thelink would break. Worse, there was no SSL certificate for the root domain when accessed without www, resulting in an ERR_SSL_VERSION_OR_CIPHER_MISMATCH error on some devices.

The Solution

I moved DNS from GoDaddy to Cloudflare and set up a wildcard redirect that preserves both the path and the query string.

Cloudflare Redirect Rule

  • Request URL: https://cyberreadykids.com/*
  • Target URL: https://www.cyberreadykids.com/${1}
  • Status Code: 301 (Permanent Redirect)
  • Preserve query string: ✅ Enabled

Additional Fix: Azure SSL for Root Domain

Cloudflare handled the redirect, but I also needed to add cyberreadykids.com as a custom domain in the Azure Static Web App to provision a valid SSL cert. Once added and verified, HTTPS started working properly for the non-www version as well.

Lessons Learned

  • GoDaddy DNS forwarding is extremely limited — it doesn’t handle paths or query strings.
  • Azure Static Web Apps doesn’t support hostname-based redirects out of the box.
  • Cloudflare gives full control over redirects, query strings, and SSL termination.
  • Mobile devices may take longer to pick up DNS changes due to aggressive caching — toggling airplane mode helps.

Now It Just Works™

All URLs, including paths and query parameters, now redirect perfectly from cyberreadykids.com to www.cyberreadykids.com. SSL is valid, the static site is fully functional, and I’ve got better DNS control moving forward thanks to Cloudflare.


Comments

Loading comments...

Leave a Comment