Calibre-web reverse proxy help

1. Caddy version (caddy version):

v2.0.0

2. How I run Caddy:

a. System environment:

Operating System: Ubuntu 18.04.4 LTS
Kernel: Linux 4.15.0-140-generic
Architecture: x86-64

b. Command:

caddy start

c. Service/unit/compose file:

# caddy.service
#
# For using Caddy with a config file.
#
# Make sure the ExecStart and ExecReload commands are correct
# for your installation.
#
# See https://caddyserver.com/docs/install for instructions.
#
# WARNING: This service does not use the --resume flag, so if you
# use the API to make changes, they will be overwritten by the
# Caddyfile next time the service is restarted. If you intend to
# use Caddy's API to configure it, add the --resume flag to the
# `caddy run` command or use the caddy-api.service file instead.

[Unit]
Description=Caddy
Documentation=https://caddyserver.com/docs/
After=network.target network-online.target
Requires=network-online.target

[Service]
User=caddy
Group=caddy
ExecStart=/usr/bin/caddy run --environ --config /etc/caddy/Caddyfile
ExecReload=/usr/bin/caddy reload --config /etc/caddy/Caddyfile
TimeoutStopSec=5s
LimitNOFILE=1048576
LimitNPROC=512
PrivateTmp=true
ProtectSystem=full
AmbientCapabilities=CAP_NET_BIND_SERVICE

[Install]
WantedBy=multi-user.target

d. My complete Caddyfile or JSON config:

a******.d***********.net {
    root * /var/www/organizr.local/html
    php_fastcgi unix//run/php/php8.0-fpm.sock
    rewrite /api/v2/* /api/v2/index.php?{query}
    file_server 
reverse_proxy /ombi* 127.0.0.1:5000
reverse_proxy /tautulli* 127.0.0.1:8181
reverse_proxy /nzbget* 127.0.0.1:6789
reverse_proxy /transmission* 127.0.0.1:9091
reverse_proxy /nzbhydra2* 127.0.0.1:5076
reverse_proxy /radarr* 127.0.0.1:7878
reverse_proxy /jackett* 127.0.0.1:9117
reverse_proxy /bazarr* 127.0.0.1:6767
reverse_proxy /sonarr* 127.0.0.1:8989
reverse_proxy /calibre* 127.0.0.1:8083
}

3. The problem I’m having:

I want to run calibre-web on reverse proxy /calibre location like other services which i have. Other services works on SSL without any problem. But when i go to a******.d***********.net/calibre url, it gives:

Calibre-Web
Error 404
Not Found

4. Error messages and/or full log output:

No specific output.

5. What I already tried:

6. Links to relevant resources:

First of, this version is very old, almost one year old! Please update to the latest v2.3.0.

This message is coming from Calibre-Web, but Calibre-Web doesn’t have a file/response on the path /calibre.

To solve it, you should either use handle_path to strip the prefix /calibre, or set
use the header_up sub-directive of reverse_proxy to set X-Script-Name to /calibre. Unfortunately this header is not explicitly documented in Calibre-Web and had to dig through the source code to figure it out.

2 Likes

If i add handle path like that just go to home page which is organizr.

a******.d***********.net {
    root * /var/www/organizr.local/html
    php_fastcgi unix//run/php/php8.0-fpm.sock
    rewrite /api/v2/* /api/v2/index.php?{query}
    file_server 
reverse_proxy /ombi* 127.0.0.1:5000
reverse_proxy /tautulli* 127.0.0.1:8181
reverse_proxy /nzbget* 127.0.0.1:6789
reverse_proxy /transmission* 127.0.0.1:9091
reverse_proxy /nzbhydra2* 127.0.0.1:5076
reverse_proxy /radarr* 127.0.0.1:7878
reverse_proxy /jackett* 127.0.0.1:9117
reverse_proxy /bazarr* 127.0.0.1:6767
reverse_proxy /sonarr* 127.0.0.1:8989
handle_path /calibre/* {
reverse_proxy  127.0.0.1:8083
}

This one works:

reverse_proxy /calibre-web* http://localhost:8083 {
header_up X-Script-Name /calibre-web
}

As mentioned in my earlier reply, this is the key header for Calibre-Web

2 Likes