Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Refused to get unsafe header "age" console error in Chrome #3686

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/loader/playlist-loader.ts
Expand Up @@ -688,8 +688,7 @@ class PlaylistLoader {

if (
this.checkAgeHeader &&
levelDetails.live &&
this.hls.config.lowLatencyMode
levelDetails.live
) {
const ageHeader = loader.getResponseHeader('age');
levelDetails.ageHeader = ageHeader ? parseFloat(ageHeader) : 0;
Expand Down
8 changes: 2 additions & 6 deletions src/utils/xhr-loader.ts
Expand Up @@ -250,12 +250,8 @@ class XhrLoader implements Loader<LoaderContext> {
}

getResponseHeader(name: string): string | null {
if (this.loader) {
try {
return this.loader.getResponseHeader(name);
} catch (error) {
/* Could not get headers */
}
if (this.loader && this.loader.getAllResponseHeaders().indexOf(name) >= 0) {
return this.loader.getResponseHeader(name);
}
return null;
}
Expand Down