网站间歇性加载失败,是否存在DNS故障?
Hey Edwin, let’s work through this intermittent loading issue you’re facing—since you suspect DNS is the culprit, and you’re using Heroku + GoDaddy + Cloudflare, there are several targeted checks we can run to narrow it down:
First, jump into your Cloudflare dashboard and verify your DNS records:
- Make sure your CNAME record points directly to
myappname.herokuapp.com—no typos, no extra characters. Also, avoid setting an overly long TTL (like 86400 seconds) because that can delay DNS updates and cause stale records to linger. Stick to 300s or Cloudflare’s auto setting. - Check the proxy status (the orange/grey cloud icon):
- If it’s orange (proxy enabled), ensure your Cloudflare SSL setting is set to Full (not Flexible). Heroku provides valid SSL certificates for your app, so Full mode ensures proper SSL handshake between Cloudflare and Heroku, preventing intermittent SSL failures that look like DNS issues.
- If it’s grey (DNS only), confirm GoDaddy doesn’t have any leftover DNS records for your domain that might conflict.
Head over to your Heroku app’s Settings > Domains and certificates:
- Confirm your custom domain is listed and marked as "verified". If it’s not, re-run the domain verification steps (Heroku will give you a TXT record to add to Cloudflare if needed).
- From your local terminal, run
heroku domains—the output should show your custom domain mapped tomyappname.herokuapp.comwithout any errors. If there’s a mismatch here, that’s a red flag.
Intermittent issues often come down to DNS caching or regional node problems:
- Use
dig yourcustomdomain.comornslookup yourcustomdomain.comon different networks (home WiFi, mobile data, a friend’s network) to see if the returned IP addresses are consistent. If you get random timeouts or different IPs, that’s a sign of DNS propagation issues or Cloudflare regional node glitches. - Flush your local DNS cache to rule out stale records:
- Windows:
ipconfig /flushdns - Mac:
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponder - Linux:
sudo systemd-resolve --flush-caches
After flushing, test your domain again to see if the loading stabilizes.
- Windows:
Cloudflare’s proxy and cache settings can sometimes cause intermittent failures:
- Check your Cloudflare Cache Rules—make sure you’re not caching dynamic content (like Django’s rendered pages) too aggressively. If a cached version of a broken page is being served randomly, that’ll look like an intermittent load failure.
- Temporarily disable Cloudflare’s WAF (Web Application Firewall) and test. If the problem stops, one of your WAF rules is probably flagging legitimate requests. You’ll need to adjust the rule or add an exception for your app’s traffic.
- Confirm Cloudflare’s "Always Use HTTPS" setting is compatible with your Heroku app. If Heroku is already enforcing HTTPS via
SECURE_SSL_REDIRECTin Django, having both enabled can cause redirect loops that manifest as intermittent failures.
As a final test, switch Cloudflare’s proxy status to grey (DNS only) and wait 10-15 minutes for DNS changes to propagate. Then test your custom domain:
- If it loads consistently now, the problem is definitely with Cloudflare’s proxy or cache settings—go back through the earlier Cloudflare checks to fix it.
- If it’s still intermittent, the issue might be with GoDaddy’s domain propagation (rare, but possible) or Heroku’s routing nodes. In that case, you can reach out to Heroku support with your app name to check for routing issues.
内容的提问来源于stack exchange,提问作者Edwin

