I’ve recently enabled Large Media, as my site is storing several mp3 files.
Since doing so, I note the content-type used when these are served is application/octet-stream, whereas previously it was audio/mpeg.
Unfortunately, this prevents them from being played by Twilio, which seems to be very particular about needing the correct content-type. This worked prior to this change.
I tried adding the following netlify.toml file, to no effect. Either I’ve done something wrong here, or it would seem that its headers entries don’t apply to Large Media files.
[[headers]]
for = "*.mp3"
[headers.values]
content-type = "audio/mpeg"
[[headers]]
for = "*.pdf"
[headers.values]
content-type = "application/pdf"
Is there any way I can change the content-type used to serve these mp3 files, or do I need to request for lfs to be disabled?
I wonder is this content-type issue what the docs are alluding to where they state:
Netlify Large Media is not suitable for streaming audio or video files. However, storing these assets for download should work well.
I found this post, which seems fairly relevant. Unfortunately, the solution there involved updating the version of git-lfs to at least 2.5.1. I can confirm that my git-lfs version is 2.9.2, and that git config lfs.contenttype is true. (This appears to be behaving as if it actually false, per the git lfs docs.)
In case its of use, I attach the output when I try to re-push a file to git lfs.
GIT_TRACE=1 GIT_TRANSFER_TRACE=1 GIT_CURL_VERBOSE=1 git lfs push origin --object-id 6088342491b4fa8deeab5b7e2b5b607647def3b7894b7b25245e66da94f1b197
00:00:20.147503 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/bin
00:00:20.149504 git.c:703 trace: exec: git-lfs push origin --object-id 6088342491b4fa8deeab5b7e2b5b607647def3b7894b7b25245e66da94f1b197
00:00:20.149504 run-command.c:662 trace: run_command: git-lfs push origin --object-id 6088342491b4fa8deeab5b7e2b5b607647def3b7894b7b25245e66da94f1b197
00:00:20.174511 trace git-lfs: exec: git 'version'
00:00:20.207517 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'rev-parse' 'HEAD' '--symbolic-full-name' 'HEAD'
00:00:20.328544 trace git-lfs: exec: git 'config' '-l'
00:00:20.344548 trace git-lfs: exec: git 'config' '-l' '-f' 'C:\Users\ftwin\Documents\Projects\bvp\.lfsconfig'
00:00:20.360552 trace git-lfs: tq: running as batched queue, batch size of 100
00:00:20.361557 trace git-lfs: tq: sending batch of size 1
00:00:20.361557 trace git-lfs: api: batch 1 files
00:00:20.361557 trace git-lfs: creds: git credential fill ("https", "cfdb2a7b-b1d3-4dee-ad78-02642c39b2d4.netlify.app", "")
00:00:20.370554 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
00:00:20.371554 git.c:439 trace: built-in: git credential fill
00:00:20.372554 run-command.c:662 trace: run_command: 'git credential-netlify get'
00:00:20.400560 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
00:00:20.401561 git.c:703 trace: exec: git-credential-netlify get
00:00:20.401561 run-command.c:662 trace: run_command: git-credential-netlify get
time="2020-11-24T00:00:20Z" level=debug msg="Initializing Netlify credential helper" args="[git-credential-netlify get]"
time="2020-11-24T00:00:20Z" level=debug msg="Git input received" host=cfdb2a7b-b1d3-4dee-ad78-02642c39b2d4.netlify.app protocol=https
time="2020-11-24T00:00:20Z" level=debug msg="Writing output data" host=cfdb2a7b-b1d3-4dee-ad78-02642c39b2d4.netlify.app password="_K8gYN****************" protocol=https username=access-token
00:00:20.804652 trace git-lfs: Filled credentials for https://cfdb2a7b-b1d3-4dee-ad78-02642c39b2d4.netlify.app/.netlify/large-media
00:00:20.810653 trace git-lfs: HTTP: POST https://cfdb2a7b-b1d3-4dee-ad78-02642c39b2d4.netlify.app/.netlify/large-media/objects/batch
> POST /.netlify/large-media/objects/batch HTTP/1.1
> Host: cfdb2a7b-b1d3-4dee-ad78-02642c39b2d4.netlify.app
> Accept: application/vnd.git-lfs+json; charset=utf-8
> Authorization: Basic * * * * *
> Content-Length: 204
> Content-Type: application/vnd.git-lfs+json; charset=utf-8
> User-Agent: git-lfs/2.9.2 (GitHub; windows amd64; go 1.12.7; git 0274d856)
>
{"operation":"upload","objects":[{"oid":"6088342491b4fa8deeab5b7e2b5b607647def3b7894b7b25245e66da94f1b197","size":53662747}],"transfers":["lfs-standalone-file","basic"],"ref":{"name":"refs/heads/master"}}00:00:21.505810 trace git-lfs: HTTP: 200
< HTTP/2.0 200 OK
< Content-Length: 144
< Age: 1
< Alt-Svc: clear
< Content-Type: application/vnd.git-lfs+json
< Date: Tue, 24 Nov 2020 00:00:22 GMT
< Server: Netlify
< Via: 1.1 google
< X-Nf-Request-Id: c7b4c924-159f-4fcf-8c3f-e2aff760eaca-26182771
<
00:00:21.508811 trace git-lfs: creds: git credential approve ("https", "cfdb2a7b-b1d3-4dee-ad78-02642c39b2d4.netlify.app", "")
00:00:21.517813 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
00:00:21.518813 git.c:439 trace: built-in: git credential approve
00:00:21.519813 run-command.c:662 trace: run_command: 'git credential-netlify store'
00:00:21.547819 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
00:00:21.548820 git.c:703 trace: exec: git-credential-netlify store
00:00:21.548820 run-command.c:662 trace: run_command: git-credential-netlify store
time="2020-11-24T00:00:21Z" level=debug msg="Initializing Netlify credential helper" args="[git-credential-netlify store]"
00:00:21.583828 run-command.c:662 trace: run_command: 'git credential-manager store'
00:00:21.610834 exec-cmd.c:237 trace: resolved executable dir: C:/Program Files/Git/mingw64/libexec/git-core
00:00:21.611834 git.c:703 trace: exec: git-credential-manager store
00:00:21.611834 run-command.c:662 trace: run_command: git-credential-manager store
00:00:21.963914 trace git-lfs: HTTP: {"transfer":"basic","objects":[{"oid":"6088342491b4fa8deeab5b7e2b5b607647def3b7894b7b25245e66da94f1b197","size":53662747,"authenticated":true}]}
{"transfer":"basic","objects":[{"oid":"6088342491b4fa8deeab5b7e2b5b607647def3b7894b7b25245e66da94f1b197","size":53662747,"authenticated":true}]}00:00:21.963914 trace git-lfs: tq: starting transfer adapter "basic"
00:00:21.963914 trace git-lfs: xfer: adapter "basic" Begin() with 8 workers
00:00:21.963914 trace git-lfs: xfer: adapter "basic" started
00:00:21.963914 trace git-lfs: xfer: adapter "basic" End()
00:00:21.963914 trace git-lfs: xfer: adapter "basic" worker 1 starting
00:00:21.964914 trace git-lfs: xfer: adapter "basic" worker 1 waiting for Auth
00:00:21.963914 trace git-lfs: xfer: adapter "basic" worker 3 starting
00:00:21.964914 trace git-lfs: xfer: adapter "basic" worker 3 waiting for Auth
00:00:21.963914 trace git-lfs: xfer: adapter "basic" worker 6 starting
00:00:21.965914 trace git-lfs: xfer: adapter "basic" worker 6 waiting for Auth
00:00:21.963914 trace git-lfs: xfer: adapter "basic" worker 2 starting
00:00:21.965914 trace git-lfs: xfer: adapter "basic" worker 2 waiting for Auth
00:00:21.963914 trace git-lfs: xfer: adapter "basic" worker 4 starting
00:00:21.965914 trace git-lfs: xfer: adapter "basic" worker 4 waiting for Auth
00:00:21.963914 trace git-lfs: xfer: adapter "basic" worker 7 starting
00:00:21.966914 trace git-lfs: xfer: adapter "basic" worker 7 waiting for Auth
00:00:21.963914 trace git-lfs: xfer: adapter "basic" worker 5 starting
00:00:21.966914 trace git-lfs: xfer: adapter "basic" worker 5 waiting for Auth
00:00:21.963914 trace git-lfs: xfer: adapter "basic" worker 0 starting
00:00:21.966914 trace git-lfs: xfer: adapter "basic" worker 0 stopping
00:00:21.966914 trace git-lfs: xfer: adapter "basic" worker 6 auth signal received
00:00:21.967914 trace git-lfs: xfer: adapter "basic" worker 6 stopping
00:00:21.966914 trace git-lfs: xfer: adapter "basic" worker 2 auth signal received
00:00:21.967914 trace git-lfs: xfer: adapter "basic" worker 2 stopping
00:00:21.966914 trace git-lfs: xfer: adapter "basic" worker 5 auth signal received
00:00:21.967914 trace git-lfs: xfer: adapter "basic" worker 5 stopping
00:00:21.966914 trace git-lfs: xfer: adapter "basic" worker 4 auth signal received
00:00:21.968914 trace git-lfs: xfer: adapter "basic" worker 4 stopping
00:00:21.966914 trace git-lfs: xfer: adapter "basic" worker 7 auth signal received
00:00:21.968914 trace git-lfs: xfer: adapter "basic" worker 7 stopping
00:00:21.966914 trace git-lfs: xfer: adapter "basic" worker 3 auth signal received
00:00:21.968914 trace git-lfs: xfer: adapter "basic" worker 3 stopping
00:00:21.966914 trace git-lfs: xfer: adapter "basic" worker 1 auth signal received
00:00:21.969915 trace git-lfs: xfer: adapter "basic" worker 1 stopping
00:00:21.969915 trace git-lfs: xfer: adapter "basic" stopped
Uploading LFS objects: 100% (1/1), 54 MB | 0 B/s, done.
00:00:21.969915 trace git-lfs: filepathfilter: rewrite ".git" as "**/.git/**"
00:00:21.969915 trace git-lfs: filepathfilter: rewrite "**/.git" as "**/.git"
00:00:21.969915 trace git-lfs: filepathfilter: accepting "tmp"
I don’t see anything obvious in there myself.