Skip to content

CDN Endpoints

API endpoints for serving Storybook files.

Base URL

Files are served via subdomain:

https://view-{project}.scry.com

Health Check

Check if the CDN service is running.

http
GET /health

Response

json
{
  "status": "healthy",
  "service": "scry-cdn-service",
  "platform": "cloudflare",
  "timestamp": "2024-01-15T10:30:00.000Z"
}

Serve Static File

Serve any file from the project's Storybook build.

http
GET /{path}

Authentication

Not required. Files are publicly accessible.

URL Format

https://view-{project}.scry.com/{path}

Path Resolution

Request PathResolved File
/index.html
/index.htmlindex.html
/iframe.htmliframe.html
/static/main.jsstatic/main.js
/assets/logo.pngassets/logo.png

Response Headers

http
HTTP/2 200
Content-Type: text/html
Cache-Control: public, max-age=31536000, immutable
Access-Control-Allow-Origin: *
ETag: "abc123"

Examples

bash
# Get homepage
curl https://view-my-project.scry.com/

# Get specific file
curl https://view-my-project.scry.com/static/main.js

# Get with verbose headers
curl -I https://view-my-project.scry.com/index.html

MIME Types

Files are served with appropriate MIME types:

ExtensionMIME Type
.htmltext/html
.jsapplication/javascript
.mjsapplication/javascript
.csstext/css
.jsonapplication/json
.svgimage/svg+xml
.pngimage/png
.jpg, .jpegimage/jpeg
.gifimage/gif
.webpimage/webp
.wofffont/woff
.woff2font/woff2
.icoimage/x-icon
Otherapplication/octet-stream

Caching

Edge Caching

Files are cached at Cloudflare's edge locations worldwide:

Cache-Control: public, max-age=31536000, immutable
  • max-age: 1 year (31,536,000 seconds)
  • immutable: Content won't change, skip revalidation

Cache Invalidation

Cached content is invalidated when:

  1. New ZIP is uploaded (new version)
  2. Cache TTL expires
  3. Manual purge (via Cloudflare dashboard)

Browser Caching

Browsers cache files according to response headers. Use unique filenames (e.g., with hashes) for cache busting.


Error Responses

400 Bad Request

Invalid subdomain format.

json
{
  "error": "Invalid subdomain. Use view-{project}.domain.com"
}

404 Not Found

File not found in the archive.

html
<!DOCTYPE html>
<html>
<head><title>404 Not Found</title></head>
<body>
<h1>Not Found</h1>
<p>The requested file was not found.</p>
</body>
</html>

500 Internal Server Error

Server error (e.g., storage unavailable).

json
{
  "error": "Internal server error"
}

SPA Fallback

For single-page applications, unknown paths fall back to index.html:

view-my-project.scry.com/about       → index.html (if about not found)
view-my-project.scry.com/users/123   → index.html (if users/123 not found)

This allows client-side routing to work correctly.


CORS

All responses include CORS headers:

http
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, HEAD, OPTIONS
Access-Control-Allow-Headers: Content-Type

This allows Storybooks to be embedded in iframes from any origin.


Performance

Response Times

ScenarioTypical Latency
Cache hit (edge)~10-30ms
Cache miss (first request)~50-100ms
Global average~30ms

Optimizations

  1. Partial ZIP extraction - Only requested bytes are fetched
  2. Central directory caching - ZIP metadata cached in KV
  3. Edge caching - Content cached at 300+ locations
  4. Compression - Files decompressed on-demand

Version Access

Latest Version

https://view-my-project.scry.com/

Serves the most recently uploaded build.

Specific Version (Optional)

If configured with path-based versioning:

https://view-my-project.scry.com/v1.0.0/
https://view-my-project.scry.com/pr-123/

Limits

LimitValue
Maximum file size100 MB
Request rateUnlimited (cached at edge)
Concurrent connectionsUnlimited

Released under the MIT License.