How to fix CORS errors for VTT subtitles
TL;DR — Fix WebVTT subtitle CORS errors by serving caption files from an allowed origin and checking track URLs, headers, and browser requests.
Related tool
HTML5 Video Subtitle Converter
VTT subtitles can fail even when the file is valid if the browser is not allowed to fetch it.
Quick answer
If captions are hosted on a different domain, configure that server to allow the video page origin to request the .vtt file.
Also confirm the VTT file itself is valid with the WebVTT Validator.
What a CORS problem looks like
Common signs include:
- captions work locally but not after deployment
- the browser console mentions CORS
- the VTT URL opens directly, but the video player does not load it
- captions are hosted on a CDN or separate domain
The player cannot override browser security rules. The server hosting the VTT file must send the right headers.
Step-by-step workflow
- Open browser developer tools.
- Find the
.vttnetwork request. - Confirm the request URL is correct.
- Check whether the response is blocked by CORS.
- Add an allowed origin header on the VTT file server.
- Reload the page and test captions again.
File checks still matter
Do not stop at CORS. The VTT file should also have:
- a
WEBVTTheader - dot-based timestamps
- parseable cue blocks
- a suitable
text/vttcontent type
Common mistakes
Moving captions to another domain without headers
If videos and captions are served from different origins, CORS rules become part of the caption setup.
Testing only by opening the VTT file
Opening the file directly is useful, but it does not prove the video page is allowed to fetch it as a track.
Ignoring CDN behavior
Some CDN rules change headers by file type or path. Check the actual response from the deployed URL.
Related guides
- How to fix VTT MIME type for HTML5 video
- Why VTT captions are not loading
- Why subtitles do not show in HTML5 video
Related tools
Use the HTML5 Video Subtitle Converter
Convert SRT or ASS subtitles to WebVTT for HTML5 video tracks and browser playback. No signup, no upload, and everything runs locally in the browser.
Open HTML5 converter