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

Restrict NGINX (public?) access to "large" files only (e.g. .mp3, .mp4, .webm) in /library/calibre-web — for PR #51 OOM workaround #57

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
34 changes: 30 additions & 4 deletions scripts/calibre-web-nginx.conf
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to keep in mind this is a temporary fix. We'll need to align with Calibre-Web architecture eventually.

Original file line number Diff line number Diff line change
@@ -1,7 +1,33 @@
# RELATED: https://github.com/janeczku/calibre-web/wiki/Setup-Reverse-Proxy

# http://box/library/calibre-web/<author>/<title>/<webm_or_mp4_video_file>
location /library/calibre-web/ {
alias /library/www/html/calibre-web/;
fancyindex on; # autoindex on;
# 2023-12-04: This is part of an (interim?) workaround so that playback of
# larger videos actually works. Far better would be a proper MM (memory
# management) solution that respects Calibre-Web's existing username/password
# security model. Can anybody suggest concrete ideas to make that happen?
#
# The failure of large videos to play is summarized here:
# https://github.com/iiab/calibre-web/issues/37
#
# This (perhaps imperfect) proposed solution is emerging here:
# https://github.com/iiab/calibre-web/pull/50
# https://github.com/iiab/calibre-web/pull/51
# https://github.com/iiab/calibre-web/issues/53
# https://github.com/iiab/iiab/pull/3676
# https://github.com/iiab/calibre-web/pull/55
# https://github.com/iiab/calibre-web/pull/56
# https://github.com/iiab/calibre-web/pull/57

# http://box/books-direct/<author>/<title>/<webm_or_mp4_video_file>

# Align NGINX path (e.g. "books-direct") with Line ~1580 of:
# https://github.com/iiab/calibre-web/blob/master/cps/web.py
location /books-direct/ {
alias /library/calibre-web/;
#autoindex off; # Directory listings (should be off by default?)

# Deny access to all other content: https://serverfault.com/a/222928
location /books-direct/ { deny all; }

# Allow serving of .webm and .mp4 files
location ~* \.(webm|mp4)$ { }
}