• Home
Home
Anti-DDoS CDNStatic & dynamic acceleration, edge scrubbingAnti-DDoS IP forwardingL4 forwarding with protected IPsSDK game shieldClient SDK for gaming workloadsAnti-DDoS serversDedicated compute with high availabilityLearn more
Gaming solutionLow latency + protectionFinancial solutionCompliance & scrubbingLive streaming solutionPush/pull at the edgeBlockchain solutionWeb3 infra protectionExplore
DocumentationAPIs & onboardingHelp centerFAQs & ticketsBlog & newsUpdates & best practicesGlobal speed testMulti-region performance checksTag cloudTopic map across the siteOpen docs
AboutMission & visionCareersHiringPartnersEcosystemContactSales & supportContact us

Documentation

  • Introduction
  • Best Practices
Docs/Cache Configuration/Content Prefetch

Content Prefetch

速盾网络 Team
Docs

Tags

  • 缓存

On this page

No outline

Share

𝕏fin

Enterprise CDN & acceleration with AI-driven monitoring and full-spectrum, real-time DDoS/CC protection. Trusted by tens of thousands of companies for fast, secure, and reliable content delivery and DDoS mitigation.

Product

  • Anti-DDoS CDN
  • Anti-DDoS IP forwarding
  • SDK game shield
  • Anti-DDoS servers

Solutions

  • Gaming solution
  • Financial solution
  • Live streaming solution
  • Blockchain solution

Resources

  • Documentation
  • Help center
  • Blog & news
  • Global speed test

Company

  • About
  • Careers
  • Partners
  • Contact

© 2026-2028 sudun.com 保留所有权利

  • Privacy
  • Terms
  • Cookies

Content prefetching proactively loads content into edge caches before users request it. This ensures cache hits from the first request, eliminating cold-start latency and improving user experience.

How Prefetching Works

code
Traditional Flow:
User Request → Cache MISS → Origin Fetch → Cache Store → Response

Prefetch Flow:
Prefetch Job → Origin Fetch → Cache Store (ready)
User Request → Cache HIT → Immediate Response

Benefits of Prefetching

BenefitDescription
Eliminate cold startsFirst visitors get cached content
Faster page loadsNo origin round-trip delay
Predictable performanceConsistent response times
Origin protectionSpread load over time

Prefetch Methods

URL List Prefetch

Prefetch specific URLs:

json
{
  "urls": [
    "https://example.com/",
    "https://example.com/products",
    "https://example.com/about",
    "https://example.com/css/styles.css",
    "https://example.com/js/app.js"
  ]
}

Best for: Known critical pages, landing pages, marketing campaigns

Sitemap Prefetch

Automatically prefetch URLs from your sitemap:

code
Sitemap URL: https://example.com/sitemap.xml

Sudun parses your sitemap and prefetches all listed URLs:

xml
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
  <url>
    <loc>https://example.com/page1</loc>
    <lastmod>2024-01-15</lastmod>
  </url>
  <url>
    <loc>https://example.com/page2</loc>
  </url>
</urlset>

Best for: Full site warming, SEO-critical pages

Crawl Prefetch

Automatically discover and prefetch linked content:

json
{
  "start_url": "https://example.com/",
  "depth": 2,
  "max_urls": 100
}

The crawler follows links to discover content:

code
Depth 0: Homepage
Depth 1: Pages linked from homepage
Depth 2: Pages linked from depth 1 pages

Best for: Dynamic sites, discovering new content

Configuring Prefetch

Dashboard Setup

  1. Go to Domains → Select your domain
  2. Navigate to Caching → Prefetch
  3. Click Create Prefetch Job
  4. Configure:

- Source: URL List, Sitemap, or Crawl

- Schedule: One-time or recurring

- Options: Headers, regions, concurrency

Prefetch Options

OptionDescriptionDefault
RegionsPoPs to prefetch intoAll regions
ConcurrencyParallel requests to origin5
HeadersCustom headers for prefetch requestsNone
Ignore RobotsSkip robots.txt restrictionsNo

Region-Specific Prefetch

Prefetch to specific geographic regions:

json
{
  "urls": ["https://example.com/"],
  "regions": ["us-east", "eu-west", "asia-pacific"]
}

Available Regions:

Region IDLocation
us-eastNorth America East
us-westNorth America West
eu-westEurope West
eu-centralEurope Central
asia-pacificAsia Pacific
asia-southSouth Asia

Scheduling Prefetch

One-Time Prefetch

Run prefetch immediately or at a scheduled time:

json
{
  "schedule": {
    "type": "once",
    "run_at": "2024-01-15T06:00:00Z"
  }
}

Recurring Prefetch

Set up automatic recurring prefetch:

json
{
  "schedule": {
    "type": "recurring",
    "interval": "daily",
    "time": "04:00",
    "timezone": "UTC"
  }
}

Schedule Options:

IntervalDescriptionUse Case
hourlyEvery hourFrequently updated content
dailyOnce per dayStandard websites
weeklyOnce per weekStatic content
customCron expressionComplex schedules

Cron Expression

For advanced scheduling:

json
{
  "schedule": {
    "type": "cron",
    "expression": "0 */6 * * *"
  }
}

Common patterns:

  • 0 4 * * * - Daily at 4 AM
  • 0 */2 * * * - Every 2 hours
  • 0 0 * * 0 - Weekly on Sunday

Custom Request Headers

Send specific headers during prefetch:

json
{
  "headers": {
    "Accept-Language": "en-US",
    "Accept-Encoding": "gzip, br",
    "X-Prefetch": "true"
  }
}

User-Agent

Configure the prefetch user agent:

json
{
  "user_agent": "Sudun-Prefetch/1.0"
}

Tip: Your origin can detect prefetch requests via the User-Agent or custom header and log them separately.

Prefetch Triggers

Deployment Trigger

Automatically prefetch after deployment:

yaml
# CI/CD integration
- name: Deploy
  run: deploy-script.sh

- name: Warm Cache
  run: |
    curl -X POST https://api.Sudun.com/v1/domains/example.com/prefetch \
      -H "Authorization: Bearer $API_KEY" \
      -d '{"sitemap": "https://example.com/sitemap.xml"}'

Webhook Trigger

Trigger prefetch via webhook:

bash
curl -X POST https://api.Sudun.com/v1/domains/example.com/prefetch/trigger \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{"job_id": "prefetch-job-123"}'

Content Update Trigger

Prefetch when content changes:

json
{
  "trigger": {
    "type": "purge",
    "action": "prefetch_after_purge"
  }
}

Monitoring Prefetch

Job Status

Track prefetch job progress:

StatusDescription
PendingJob queued
RunningPrefetch in progress
CompletedAll URLs prefetched
FailedJob failed (see errors)
PartialSome URLs failed

Prefetch Metrics

View metrics in the dashboard:

  • URLs Processed: Total URLs prefetched
  • Success Rate: Percentage of successful prefetches
  • Average Latency: Origin response time during prefetch
  • Cache Fill: Amount of content cached

Prefetch Logs

json
{
  "job_id": "pf-abc123",
  "status": "completed",
  "started_at": "2024-01-15T04:00:00Z",
  "completed_at": "2024-01-15T04:05:32Z",
  "stats": {
    "total_urls": 150,
    "successful": 148,
    "failed": 2,
    "skipped": 0
  }
}

Best Practices

Prioritize Critical Content

Prefetch most important pages first:

json
{
  "urls": [
    {"url": "https://example.com/", "priority": "high"},
    {"url": "https://example.com/products", "priority": "high"},
    {"url": "https://example.com/blog", "priority": "medium"},
    {"url": "https://example.com/about", "priority": "low"}
  ]
}

Respect Origin Capacity

Configure concurrency to avoid overloading origin:

json
{
  "concurrency": 3,
  "rate_limit": "10/second"
}

Schedule During Off-Peak

Run prefetch when traffic is lowest:

code
Peak Hours: 9 AM - 6 PM
Prefetch Window: 2 AM - 5 AM

Exclude Dynamic Content

Skip URLs that shouldn't be prefetched:

json
{
  "exclude_patterns": [
    "/api/*",
    "/admin/*",
    "*.json",
    "*?session=*"
  ]
}

Troubleshooting

Prefetch Not Working

  1. Check origin accessibility: Ensure origin responds to prefetch requests
  2. Verify URL format: URLs must be fully qualified (https://...)
  3. Check robots.txt: Enable "Ignore Robots" if blocked
  4. Review error logs: Check for specific URL failures

High Origin Load

If prefetch overloads your origin:

  1. Reduce concurrency setting
  2. Add rate limiting
  3. Schedule during off-peak hours
  4. Use incremental prefetch

Cache Not Warming

If content isn't cached after prefetch:

  1. Verify cache rules allow caching
  2. Check origin response headers
  3. Ensure TTL isn't too short
  4. Confirm prefetch completed successfully

API Reference

Create Prefetch Job

bash
curl -X POST https://api.Sudun.com/v1/domains/example.com/prefetch \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "urls": [
      "https://example.com/",
      "https://example.com/products"
    ],
    "regions": ["us-east", "eu-west"],
    "concurrency": 5
  }'

Prefetch from Sitemap

bash
curl -X POST https://api.Sudun.com/v1/domains/example.com/prefetch \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "sitemap": "https://example.com/sitemap.xml",
    "schedule": {
      "type": "daily",
      "time": "04:00"
    }
  }'

Get Prefetch Status

bash
curl -X GET https://api.Sudun.com/v1/domains/example.com/prefetch/job-123 \
  -H "Authorization: Bearer YOUR_API_KEY"

Need help with content prefetching? Contact support@Sudun.com