Reverse Proxy🔗
This contains examples for how to use docspell behind a reverse proxy.
For the examples below, assume the following:
- Docspell app is available at
192.168.1.11:7880
. If it is running on the same machine as the reverse proxy server, you can setlocalhost:7880
instead. - The external domain/hostname is
docspell.example.com
Configuring Docspell🔗
These settings require a complement config part in the docspell configuration file:
-
First, if Docspell REST server is on a different machine, you need to change the
bind.address
setting to be either0.0.0.0
or the ip address of the network interface that the reverse proxy server connects to.Note that a value of
0.0.0.0
instead of192.168.1.11
will bind the server to every network interface. -
(Optional) Docspell needs to know the external url. The
base-url
setting should point to the external address. Using above values, it would behttps://docspell.example.com
.You can also leave the default settings (
localhost
), in this case Docspell uses the request header to determine the external url.
Note that this example assumes that the docspell-joex component is on the same machine. This page is only related for exposing the REST server and web application.
If you have examples for more http servers (e.g. apache), please let me know or add it to this site.
Headers🔗
If base-url
is left to its default, then Docspell tries to find the
external URL from the http request. When using a reverse proxy, you
then need to pass some information from the original request so
Docspell can construct the correct url. These headers are evaluated:
X-Forwarded-Host
X-Forwarded-Proto
X-Forwarded-Port
X-Forwarded-For
Example for nginx:
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Port 443;
proxy_set_header X-Forwarded-Proto https;
Nginx🔗
This defines two servers: one listens for http traffic and redirects
to the https variant. Additionally it defines the let's encrypt
.well-known
folder name.
The https server endpoint is configured with the let's encrypt
certificates and acts as a proxy for the application at
192.168.1.11:7880
.
Caddy🔗
docspell.example.com {
reverse_proxy http://192.168.1.11:7880
}
Traefik 2🔗
http:
routers:
docspell:
rule: "Host(`docspell.example.com`)"
service: docspell
entryPoints:
- web-secure # or whatever you named it for SSL
services:
docspell:
loadBalancer:
servers:
- url: http://192.168.1.11:7880 # the ip of the container, localhost if you use docker port mapping
healthCheck:
path: /api/info/version