Jamdesk Documentation logo

AWS Route 53 & CloudFront

Proxy /docs traffic through AWS CloudFront and Route 53 to your Jamdesk site. Includes distribution setup, origin configuration, and cache behavior rules.

Set up a CloudFront distribution to forward /docs/* to your Jamdesk site, with Route 53 for DNS. Takes about 15 minutes.

Prerequisites

  • An AWS account with CloudFront and Route 53 access
  • Your domain managed in Route 53 (or ability to update DNS elsewhere)
  • Your Jamdesk subdomain (found in dashboard settings)
  • Your custom domain registered and DNS-verified in the Jamdesk dashboard

Step 1: Create a CloudFront Distribution

  1. Open the CloudFront console
  2. Click Create Distribution
  3. Configure the origin:
SettingValue
Origin domainYOUR_SLUG.jamdesk.app
ProtocolHTTPS only
Namejamdesk-docs-origin

Replace YOUR_SLUG with your actual Jamdesk subdomain.

Step 2: Configure Origin Settings

In the origin settings, add custom headers to identify your domain:

Header nameValue
X-Forwarded-Hostyoursite.com
X-Jamdesk-Forwarded-Hostyoursite.com

These headers tell Jamdesk which domain is making the request.

This step is required, and skipping it fails quietly. The AllViewerExceptHostHeader policy (next step) only forwards headers your visitor's browser sent — it does not add new ones — so X-Jamdesk-Forwarded-Host only reaches Jamdesk as an origin custom header. Without it, requests still succeed, but pages serve noindex with canonical links pointing at YOUR_SLUG.jamdesk.app instead of your domain.

If you serve multiple alternate domain names from one distribution, static origin headers can't vary per request — use a CloudFront Function on viewer request instead, setting request.headers['x-jamdesk-forwarded-host'] = { value: request.headers.host.value }.

Step 3: Create Cache Behaviors

Add behaviors to route /docs/* and asset requests to your Jamdesk origin:

  1. Go to the Behaviors tab
  2. Click Create Behavior
  3. Create three behaviors with these settings:
Path patternOriginCache policyOrigin request policy
/docs/*jamdesk-docs-originCachingOptimizedAllViewerExceptHostHeader
/_next/*jamdesk-docs-originCachingOptimizedAllViewerExceptHostHeader
/_jd/*jamdesk-docs-originCachingOptimizedAllViewerExceptHostHeader

Set Viewer protocol policy to Redirect HTTP to HTTPS for all three.

All three behaviors are required: /_next/* and /_jd/* serve the JavaScript, CSS, fonts, and images your docs pages load. The AllViewerExceptHostHeader policy forwards the viewer's request headers (everything except Host, which CloudFront reserves for the origin) and must be set on all three.

Step 4: Add Alternate Domain Name

  1. In the General tab, click Edit
  2. Under Alternate domain name (CNAME), add yoursite.com
  3. Select or request an SSL certificate for your domain

Step 5: Configure Route 53

Create an alias record pointing to your CloudFront distribution:

  1. Open the Route 53 console
  2. Select your hosted zone
  3. Click Create Record
  4. Configure:
SettingValue
Record nameyoursite.com (or leave blank for apex)
Record typeA
AliasYes
Route traffic toCloudFront distribution
DistributionSelect your distribution

Step 6: Verify

After DNS propagation (usually 5-15 minutes), visit https://yoursite.com/docs to confirm your documentation loads correctly.

Complete CloudFront Configuration Summary

Distribution Settings:
├── Origin: YOUR_SLUG.jamdesk.app
   ├── Custom Header: X-Forwarded-Host = yoursite.com
   └── Custom Header: X-Jamdesk-Forwarded-Host = yoursite.com
├── Behavior: /docs/*
   ├── Cache Policy: CachingOptimized
   └── Origin Request Policy: AllViewerExceptHostHeader
├── Behavior: /_next/*
   ├── Cache Policy: CachingOptimized
   └── Origin Request Policy: AllViewerExceptHostHeader
├── Behavior: /_jd/*
   ├── Cache Policy: CachingOptimized
   └── Origin Request Policy: AllViewerExceptHostHeader
└── Alternate Domain: yoursite.com (with SSL certificate)

Troubleshooting

Ensure the origin domain is exactly YOUR_SLUG.jamdesk.app without https:// prefix.

Verify the Viewer protocol policy is set to "Redirect HTTP to HTTPS" and your SSL certificate is valid.

Create a CloudFront invalidation for /docs/* to clear cached content after publishing changes.

If you see "Domain is not authorized to serve this content":

  1. Verify your domain is registered in the Jamdesk dashboard
  2. Complete DNS verification (TXT record) for your domain
  3. Ensure both X-Forwarded-Host and X-Jamdesk-Forwarded-Host custom headers are set in your origin configuration
  4. Check that your domain maps to the correct project

The domain must be verified before CloudFront can serve documentation.

Preflight fetches /_jd/preflight on your live domain and checks what actually reached Jamdesk. If it reports your proxy "doesn't identify itself," CloudFront is reaching Jamdesk but without X-Jamdesk-Forwarded-Host — recheck the origin custom header in Step 2. See Custom domain only for what each preflight message means.

What's Next?

Custom Domain Only

Stop your subdomain from answering directly

Custom Domains

Verify DNS and troubleshoot

Subpath Hosting

Serve docs at /docs