I am trying to set up Caliber-Web behind a reverse proxy on NixOS, and so far I have not had any success.
I have tried the basic:
# Calibre-Web
services.calibre-web= {
enable = true;
group = "media";
options = {
calibreLibrary = "/mnt/media/ebook";
enableBookUploading = true;
};
};
With this, I can access the web interface on localhost:8083. I have a working virtual host that I have used to proxy other items:
services.nginx = {
enable = true;
# Use recommended settings
recommendedGzipSettings = true;
recommendedOptimisation = true;
recommendedProxySettings = true;
recommendedTlsSettings = true;
commonHttpConfig = ''
# Add HSTS header with preloading to HTTPS requests.
# Adding this header to HTTP requests is discouraged
map $scheme $hsts_header {
https "max-age=31536000; includeSubdomains; preload";
}
add_header Strict-Transport-Security $hsts_header;
'';
virtualHosts."example.com" = {
enableACME = true;
forceSSL = true;
To this, I have added the following location:
locations."/" = {
proxyPass = "http://127.0.0.1:8083";
proxyWebsockets = true;
extraConfig =
"client_max_body_size 1024M;"
;
};
However, when I point a web browsers to this location, I get the Nginx 502 Bad Gateway page.
I have tried playing around with the reverseProxyAuth Nixos option:
# Calibre-Web
services.calibre-web= {
enable = true;
group = "media";
options = {
calibreLibrary = "/mnt/media/ebook";
enableBookUploading = true;
reverseProxyAuth.enable = true;
reverseProxyAuth.header = "admin";
};
};
But this to give me he Nginx 502 Bad Gateway page.
I have found the following direction to get Caliber-Web behind a Reverse Proxy in general Linux and tried putting them into my Nix config with the extraConfig = option, but this too gives the Nginx 502 Bad Gateway page.
https://github.com/janeczku/calibre-web/wiki/Setup-Reverse-Proxy
Any suggestion on how to get Caliber-Web with a Reverse Proxy working on NixOS? Bonus points to get it to work in a subdirectory, e.g. https://example.com/calibre-web.
Thank you