Repository navigation
Caching and security
This article explains part of Radio 2.0 in plain words. It is not normative: where it differs from the specification, the specification is right.
Caching and security in Radio 2.0 are the rules that keep manifests cheap to serve, safe to fetch and hard to abuse. They set how long a manifest may be cached, which addresses must use https, and the limits any server follows when it fetches a URL taken from someone else's manifest.
| Defined in | Specification section 10 |
| Cache headers |
ETag, Cache-Control: max-age=300
|
| Fetch limits | 10 seconds, 256 KiB (64 KiB per event), 5 redirects, no downgrade to http
|
| Tiers | Production, Development |
| Status | Draft |
- The manifest and
schedule.jsonmust be served with anETagand should carryCache-Control: max-age=300. - Consumers must send
If-None-Matchwhen they hold a copy, and should not fetch a manifest more often than every 5 minutes. - The event stream must not be cached. The poll address should carry a
max-ageof at most 5 seconds, and a consumer must not poll more often than every 5 seconds. - Public manifests, events and schedules should send
Access-Control-Allow-Origin: *, so web players on other sites can read them. - A temporary outage should be answered with 503 and
Retry-After, so directories do not drop a station during a short break.
Production. manifestUrl, homepage, events and schedule URLs must use https. Stream URLs should use https but may use http for older players and devices; a consumer that can use TLS should prefer an https stream of the same content. No URL in a production manifest, streams included, may name a development host. A validator reports one as an error, and a consumer skips the stream or link.
Development. A manifest is in the development tier when its manifestUrl, homepage, events or schedule URLs use http or name a development host. http is allowed only for these hosts: localhost, *.localhost, *.local, *.internal, *.test, loopback addresses, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16 and fc00::/7. A development-tier manifest is never verified; see Verification and ownership.
A directory, or any server that fetches URLs taken from manifests, is an obvious target for requests aimed at internal networks. The rules say it must:
- refuse development-tier addresses, and any address that resolves to one, unless it is configured for development;
- follow at most 5 redirects;
- stop after 256 KiB (64 KiB per event);
- give up after 10 seconds.
The reference implementation enforces these limits and also refuses a downgrade from https to http. See Reference implementation.
- Text fields are plain text and must not be rendered as HTML.
- Ownership rests on the homepage origin; see Verification and ownership.
- Transmitter coordinates are optional so publishers can leave them out for privacy or security.
Report problems in the library, the command line tool, the in-browser validator or the security rules privately through GitHub's "Report a vulnerability" on the repository Security tab. Do not open a public issue. Reports are acknowledged within 7 days. While the version starts with 0., only the main branch is supported.
- Using
httpforhomepageormanifestUrlin production (the invalid filesmanifest--homepage-http-production.jsonandmanifest--manifesturl-http-production.jsonfail). - Listing a development host such as
localhostin a production stream URL (manifest--stream-dev-host-production.json). - Polling faster than every 5 seconds.
Radio 2.0 is an open standard, MIT licensed. Documentation: radio2.org. Questions: Discussions.
Overview
The manifest
Discovery and identity
Live data
Money
Implementations and tools
- Implementations
- Reference implementation
- radio2 command line tool
- Create a manifest
- Conformance
- Stations
- Brand and badges
Project
Documentation
Community