mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-03-02 22:46:55 -05:00
[Bug]: RSS feed serves m4b files with Content-Type: application/octet-stream instead of audio/mp4 #3223
Labels
No labels
authentication
awaiting release
backlog
bug
chapter editor
config-issue
ebooks
encoding/embedding
enhancement
help wanted
listening sessions & progress
planned
possible plugin
progress sync
sorting/filtering/searching
unable to reproduce
upload
users & permissions
waiting
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/audiobookshelf-advplyr#3223
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jordwil on GitHub (Feb 8, 2026).
What happened?
When serving audiobook files via the RSS feed endpoint (
/feed/:slug/item/:episodeId/*),.m4bfiles are served withContent-Type: application/octet-streaminstead ofaudio/mp4.This is because
RssFeedManager.getFeedItem()inserver/managers/RssFeedManager.jsusesres.sendFile(episodePath)without setting the Content-Type header. Express'ssendFilerelies on themimepackage for content-type lookup, and.m4bis not in the standard MIME database, so it falls back toapplication/octet-stream.This causes slow playback start (10-20+ seconds) in podcast clients like Apple Podcasts when consuming audiobook RSS feeds, because the client cannot identify the audio format from the response headers and must sniff the file content instead.
This is the same underlying issue that was fixed for the download endpoint in PR #3319 (issue #3310), but the RSS feed file-serving codepath was not included in that fix.
Root cause
In
server/managers/RssFeedManager.jsline ~192:Compare with the download endpoint in
server/controllers/LibraryItemController.jswhich correctly usesgetAudioMimeTypeFromExtname():Also compare with
getFeedCover()in the sameRssFeedManager.jsfile, which correctly sets the content type:Suggested fix
Use
getAudioMimeTypeFromExtname()(fromserver/utils/fileUtils.js) ingetFeedItem()to set the correct Content-Type before callingres.sendFile():The
AudioMimeTypemap inserver/utils/constants.jsalready correctly maps.m4b→audio/mp4.What did you expect to happen?
RSS feed episode files should be served with the correct
Content-Type: audio/mp4header for.m4bfiles (and correct MIME types for other audio formats), matching the behavior of the download endpoint.Steps to reproduce the issue
.m4bfilesContent-Typewill beapplication/octet-streamVerify with curl:
Audiobookshelf version
v2.32.1
How are you running audiobookshelf?
Docker
What OS is your Audiobookshelf server hosted from?
Linux
Logs
No response
Additional Notes
Workaround: If using a reverse proxy (e.g., Caddy, nginx), you can rewrite the Content-Type header at the proxy level:
Caddy example:
Note: this workaround replaces
application/octet-streamwithaudio/mp4for all responses from ABS, which works if your ABS instance primarily serves audiobooks. A server-side fix is more appropriate.This issue affects all audio formats not in the standard
mimepackage lookup table, but.m4bis the most common case since it's the standard audiobook format.