Skip to main content

Configuring a CDN

Introduction​

Content Delivery Networks (CDNs) are essential for delivering live streams to large, geographically distributed audiences with minimal latency. This guide will walk you through the process of configuring a CDN with Native Frame's streaming service.

Prerequisites​

Before configuring your CDN, ensure you have:

  • A Native Frame account with streaming enabled
  • Access to your chosen CDN provider's dashboard
note

Private streaming is not supported with CDNs.

Understanding Origin URLs​

The origin URL is the source from which your CDN will pull the live stream content. Native Frame's origin URL is:

https://badlands-border-cdn.platform.nativeframe.com

CDN Configuration Steps​

1. Create a CDN Distribution​

  1. Log into your CDN provider's dashboard
  2. Create a new distribution/configuration
  3. Set the following parameters:
    • Origin Domain: Your Native Frame origin URL
    • Distribution Protocol: HTTPS
    • Allowed HTTP Methods: GET, HEAD, OPTIONS
    • Cache Behavior: Use origin cache headers
    • Origin Protocol Policy: HTTPS Only

2. Configure Cache Settings​

For optimal live streaming performance, configure these cache settings:

{
"CacheBehavior": {
"MinTTL": 0,
"DefaultTTL": 86400,
"MaxTTL": 31536000,
"QueryStringBehavior": "ignore"
}
}

3. Configure SSL/TLS​

  1. Request or upload an SSL certificate for your CDN domain
  2. Enable HTTPS-only access
  3. Set minimum TLS version to 1.2

4. Set up CORS Headers​

Add these required CORS headers in your CDN configuration:

{
"Headers": {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "GET, HEAD, OPTIONS",
"Access-Control-Allow-Headers": "Origin, Content-Type, Accept"
}
}

5. Configure Health Checks​

Set up health checks to monitor your origin:

{
"HealthCheck": {
"Protocol": "HTTPS",
"Path": "/health",
"IntervalSeconds": 30,
"FailureThreshold": 3
}
}

Integrating with Native Frame​

After configuring your CDN, update your Native Frame configuration:

  1. Access the Native Frame dashboard
  2. Navigate to Project Settings > CDN
  1. Add your CDN domain as an allowed origin
  1. Update your stream configuration to use the CDN URL
  1. Test the configuration
note

If the test fails, wait a few minutes and try again.

You can update your CDN settings at any time by navigating to Project Settings > CDN

Testing Your Configuration​

  1. Start a test stream using Native Frame's dashboard
  2. Verify the stream is accessible via your CDN URL
  3. Monitor CDN metrics for:
    • Cache hit ratio
    • Latency
    • Error rates
    • Bandwidth usage

Best Practices​

  1. Geographic Distribution

    • Deploy CDN endpoints in regions where your viewers are located
    • Use multiple CDN providers for redundancy
  2. Cache Optimization

    • Set appropriate TTL values for different content types
    • Implement cache purge mechanisms for updates
  3. Security

    • Enable HTTPS-only access
    • Implement token authentication if required
    • Set up IP address restrictions where necessary
  4. Monitoring

    • Set up alerts for origin failures
    • Monitor CDN performance metrics
    • Track bandwidth usage and costs

Troubleshooting​

Common issues and solutions:

  1. High Latency

    • Verify CDN endpoint distribution
    • Check origin connection settings
    • Review caching configuration
  2. Playback Errors

    • Verify CORS configuration
    • Check SSL/TLS settings
    • Confirm origin health status
  3. Cache Issues

    • Review cache behavior settings
    • Check query string handling
    • Verify TTL configuration

Support​

For assistance with CDN configuration, contact Native Frame support: