0

I'm trying to use Apache2 as a reverse proxy to access an application (calibre web) running inside a Docker container. Since the application is using redirects (more details here), I'm trying to use apache's mod_substitute to modify the URLs in the redirects so they point to the right URL. I wrote the following inside a file called calibreweb.conf and enabled both the site and the substitute mod.

<Location /calibre-web>
    ProxyPass http://127.0.0.1:8083
    ProxyPassReverse http://127.0.0.1:8083
    AddOutputFilterByType SUBSTITUTE text/html
    Substitute "s|https://subdomain.example.com/|https://subdomain.example.com/calibre-web/|i"

</Location>

The problem is that, after restarting Apache, the mod isn't doing anything. As a sanity check I tried changing the substitute pattern to Substitute "s|admin|user|i", as the first redirect contains admin, but I still get redirected to subdomain.example.com/admin/dbconfig. Adding SetOutputFilter SUBSTITUTE,DEFLATE just above the AddOutputFilterByType line didn't help. Also removing the content-type filter so that the file becomes

<Location /calibre-web>
    ProxyPass http://127.0.0.1:8083
    ProxyPassReverse http://127.0.0.1:8083
    Substitute "s|https://nas.gtpware.eu/|https://nas.gtpware.eu/calibre-web/|i"

</Location>

didn't fix it. Any idea why this doesn't work? It looks like the example given in Apache2's documentation to me. Thank you for your help,

GTP95

GTP95
  • 11
  • 2

1 Answers1

0

Turns out that Calibre web has a working example in their wiki here. It boils down to:

<Location /calibre-web >
        RequestHeader set X-SCRIPT-NAME /calibre-web
        RequestHeader set X-SCHEME https
        ProxyPass http://localhost:8083/
        ProxyPassReverse http://localhost:8083/
        ProxyPassReverseCookiePath  /  /calibre-web/
</Location>
GTP95
  • 11
  • 2