AWS Route 53 and CloudFront
Use AWS CloudFront to serve your blog at a subpath like yoursite.com/blog. CloudFront behaviors route requests to different origins based on URL patterns, letting you serve both your main site and Waldium blog from a single domain.
Overview
You'll configure CloudFront behaviors to route traffic appropriately:
| Path | Destination | Caching |
|---|---|---|
/.well-known/acme-challenge/* | Your main site | Disabled |
/.well-known/vercel/* | Your main site | Disabled |
/blog/* | [SUBDOMAIN].waldium.app | Disabled |
/blog | [SUBDOMAIN].waldium.app | Disabled |
/waldium-assets/_next/static/* | [SUBDOMAIN].waldium.app | Enabled |
Default (*) | Your main site | Enabled |
All behaviors must use the origin request policy AllViewerExceptHostHeader.
Create a CloudFront Distribution
- Open the CloudFront console in AWS
- Click Create distribution
- For Origin domain, enter
[SUBDOMAIN].waldium.app(your Waldium subdomain) - Under Web Application Firewall (WAF), enable security protections
- Keep other settings at their defaults
- Click Create distribution
Add Your Main Site Origin
After creating the distribution, add an origin for your main site:
- Navigate to the Origins tab
- Click Create origin
- Enter your main site's staging URL as the Origin domain
Use a staging URL that mirrors your main site. For Vercel, this is your .vercel.app domain. For Webflow, use your .webflow.io staging URL.
You should now have two origins:
[SUBDOMAIN].waldium.app— Your Waldium blog- Your main site staging URL — Your landing page and other content
Configure Behaviors
Behaviors control how CloudFront routes requests. Navigate to the Behaviors tab and create the following:
.well-known/* Behavior
This ensures domain verification and SSL certificate provisioning work correctly:
- Click Create behavior
- Set Path pattern to
/.well-known/* - Set Origin to your main site
- Set Cache policy to CachingDisabled
- Set Origin request policy to AllViewerExceptHostHeader
- Set Viewer protocol policy to Redirect HTTP to HTTPS
For more specific control, create separate behaviors for /.well-known/vercel/* and /.well-known/acme-challenge/*.
/blog Behavior
Route the base blog path to Waldium:
- Click Create behavior
- Set Path pattern to
/blog - Set Origin to
[SUBDOMAIN].waldium.app - Set Cache policy to CachingOptimized
- Set Origin request policy to AllViewerExceptHostHeader
- Set Viewer protocol policy to Redirect HTTP to HTTPS
/blog/* Behavior
Route all blog subpaths to Waldium:
- Click Create behavior
- Set Path pattern to
/blog/* - Set Origin to
[SUBDOMAIN].waldium.app - Set Cache policy to CachingOptimized
- Set Origin request policy to AllViewerExceptHostHeader
- Set Viewer protocol policy to Redirect HTTP to HTTPS
/waldium-assets/_next/static/* Behavior
Enable caching for static assets:
- Click Create behavior
- Set Path pattern to
/waldium-assets/_next/static/* - Set Origin to
[SUBDOMAIN].waldium.app - Set Cache policy to CachingOptimized
- Set Origin request policy to AllViewerExceptHostHeader
- Set Viewer protocol policy to Redirect HTTP to HTTPS
Update Default Behavior
Finally, configure the default behavior to serve your main site:
- Select the Default (*) behavior
- Click Edit
- Change Origin to your main site staging URL
- Set Cache policy to CachingOptimized
- Set Origin request policy to AllViewerExceptHostHeader
- Click Save changes
Verify Your Configuration
Your behaviors should now include:
| Path Pattern | Origin | Cache Policy |
|---|---|---|
/.well-known/* | Main site | CachingDisabled |
/blog | [SUBDOMAIN].waldium.app | CachingOptimized |
/blog/* | [SUBDOMAIN].waldium.app | CachingOptimized |
/waldium-assets/_next/static/* | [SUBDOMAIN].waldium.app | CachingOptimized |
Default (*) | Main site | CachingOptimized |
Test the Distribution
Before connecting your domain, test using the CloudFront distribution URL:
- Go to the General tab
- Copy the Distribution domain name (e.g.,
d1234abcd.cloudfront.net) - Visit that URL—you should see your main site
- Append
/blog—you should see your Waldium blog
Connect with Route 53
Link your CloudFront distribution to your domain using Route 53:
- Open Route 53 in the AWS console
- Navigate to your domain's Hosted zone
- Click Create record
- Toggle Alias on
- For Route traffic to, select Alias to CloudFront distribution
- Choose your distribution from the dropdown
- Click Create records
If an A record already exists for your domain, you'll need to remove it first.
DNS Propagation
After configuration, your blog should be accessible within a few minutes. DNS propagation typically takes 1-4 hours but can occasionally take up to 48 hours. If the subpath isn't working immediately, wait before troubleshooting.