Skip to main content

CDN

One-click edge caching for static assets served by any RailPush service. Assets are cached at edge nodes close to your users -- CSS, JS, images, and fonts load faster with zero code changes.

How it works​

  • Enable CDN for any web or static service from the Networking tab
  • RailPush inserts a caching layer in front of your service's ingress
  • Cache is keyed on the full URL -- query params included
  • Your service's Cache-Control headers are respected; RailPush adds sensible defaults for known asset types

Default cached file types​

.js, .css, .woff2, .woff, .ttf, .otf, .png, .jpg, .jpeg, .gif, .svg, .ico, .webp, .avif, .mp4, .webm

Configure cache TTL​

API: Enable CDN and set TTL
curl -X PATCH https://railpush.com/api/v1/services/<id>/cdn \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"enabled": true,
"default_ttl_seconds": 86400,
"stale_while_revalidate_seconds": 3600
}'

Purge cache​

API: Purge
# Purge entire cache for a service
curl -X POST https://railpush.com/api/v1/services/<id>/cdn/purge \
-H "Authorization: Bearer <token>"

# Purge a specific path
curl -X POST https://railpush.com/api/v1/services/<id>/cdn/purge \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{"path": "/assets/app.js"}'