Lab 2

Redirect behavior and canonical application routing

Lab 2 demonstrates how Cloudflare can normalize traffic from alternate hostnames to the correct canonical application URL.

Scenario

A customer has multiple hostnames and wants traffic consolidated to the preferred application URL without creating redirect loops, duplicate entry points, or confusing user paths.

Objective

Use Cloudflare Redirect Rules to send requests from app.ybarra-cflab.com to the canonical application path at https://www.ybarra-cflab.com/app/. The goal is to prove that DNS does not perform redirects, CNAMEs do not perform redirects, and canonical URL behavior should be handled intentionally at the HTTP layer.

Outcomes

  • Confirmed that app.ybarra-cflab.com is reachable through Cloudflare.
  • Configured redirect behavior from the app hostname to the canonical app route.
  • Validated that the redirect returns a clean 301 response.
  • Confirmed that the final destination loads the beautified /app/ page.
  • Documented the difference between DNS records, CNAMEs, and HTTP redirects.

Environment / Build

  • Source hostname: https://app.ybarra-cflab.com
  • Canonical destination: https://www.ybarra-cflab.com/app/
  • Cloudflare Redirect Rule: hostname-based redirect
  • Redirect status: 301
  • Validation tool: curl -IL

Demonstrable Content

curl -IL https://app.ybarra-cflab.com

Expected result:

HTTP/2 301
location: https://www.ybarra-cflab.com/app/

Validate the final app page:

curl -sL https://app.ybarra-cflab.com | grep -i "Cloudflare Pages app path"

What Was Completed

  • Created and validated the app-specific hostname.
  • Configured Cloudflare redirect behavior for the app hostname.
  • Redirected app hostname traffic to https://www.ybarra-cflab.com/app/.
  • Validated the redirect chain with curl -IL.
  • Confirmed the final destination returns the expected app page content.

Lab 2 Technical Summary

Lab 2 implemented hostname-based canonical routing using Cloudflare Redirect Rules. Requests to app.ybarra-cflab.com are matched at the Cloudflare edge and returned as a permanent redirect to https://www.ybarra-cflab.com/app/. This demonstrates that DNS and CNAME records control name resolution, but they do not perform HTTP redirects. It also demonstrates how redirect logic can be centralized at Cloudflare to avoid inconsistent origin-side redirects or redirect loops.

Lab 2 Customer-Facing Summary

This lab makes sure users who visit the app-specific address are automatically sent to the correct application page. That gives the customer one clean application URL, avoids confusion, and makes the environment easier to support. It also shows that Cloudflare can handle this routing behavior at the edge without requiring application code changes.