internetarchive / iiif

The official Internet Archive IIIF service
GNU General Public License v3.0
22 stars 4 forks source link

Need to set CORS headers for VTT files? #53

Closed glenrobson closed 3 months ago

glenrobson commented 8 months ago

Transfered from https://github.com/ArchiveLabs/iiif.archivelab.org/issues/134

In testing the addition of VTT subtitles to A/V files for accessibility, I think I'm running into CORS header issues.

See here:

https://cors-test.codehappy.dev/?url=https%3A%2F%2Farchive.org%2Fdownload%2Fcc4ia-Polar_Plunge_Promo_-_2018%2FPolar_Plunge_Promo_-_2018.en.vtt&origin=https%3A%2F%2Fiiif-react-media-player.netlify.app%2F%2F%3Fiiif-content%3D&method=get

Before we can get the VTT subtitles to work, I think we'll need to open access to VTT (and probably SRT?) files

glenrobson commented 8 months ago

Comment from Mike:

This seems to be something that applies to files that don't come from the internal iaXXXXXXXXX.us.archive.org servers:

Item that redirects to the internal servers and does have CORS origin set (and thus works in the viewers):

mike@revelator:~$ curl -i http://archive.org/download/gd89-07-04.sbd.hinko.18542.sbeok.shnf/gd1989-07-04d1t01.mp3
HTTP/1.1 302 Found
Server: nginx/1.25.1
Date: Thu, 03 Aug 2023 21:37:17 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Access-Control-Allow-Origin: *
Accept-Ranges: bytes
Location: http://ia800906.us.archive.org/21/items/gd89-07-04.sbd.hinko.18542.sbeok.shnf/gd1989-07-04d1t01.mp3
Strict-Transport-Security: max-age=15724800
Referrer-Policy: no-referrer-when-downgrade

VTT file that seemingly comes direct from the archive.org webserver and does not have CORS:

mike@revelator:~$ curl -i https://archive.org/download/cc4ia-Polar_Plunge_Promo_-_2018/Polar_Plunge_Promo_-_2018.en.vtt
HTTP/2 200 
server: nginx/1.25.1
date: Thu, 03 Aug 2023 21:37:57 GMT
content-type: text/plain;charset=UTF-8
strict-transport-security: max-age=15724800
referrer-policy: no-referrer-when-downgrade
glenrobson commented 3 months ago

We decided to proxy the VTT files so we could set the CORS headers