r/BookStack • u/BagCompetitive357 • Aug 29 '25
Cannot set up Bookstack behind Cloudflare Tunnels
Hi
I have difficulty installing and set up Bookstack behind Cloudflare Tunnels. I have a yaml file for an installation behind a reverse proxy that is working. I changed it for CF as below. On CF, I tried several possibilities including http://localhost:6875.
I searched a lot, and I don't seem to be able to find the issue. I understand Bookstack takes only one URL, and APPI_URL must be the external and internal access url. Each time a change is made, the containers and volumes are removed.
Could this be a caching problem in CF? Some people mention you have to wait 30 minutes after some changes.
How to check inside container that env variable APP_URL is correctly set (so that, the docker does not silently ignore the yaml file and fall back to local host)? I set the APP_DEBUG environment variable and nothing strange is reported.
Update It seems the application’s domain set in CF Tunnels should be a subdomain, but cannot be a sub-subdomain, in the free plan.
services:
bookstack:
image: lscr.io/linuxserver/bookstack:latest
container_name: bookstack
environment:
- PUID=1000
- PGID=1000
- TZ=Etc/UTC
- APP_URL=https://mydomain.cm
- APP_KEY=
- DB_HOST=bookstack_db
- DB_DATABASE=bookstackdbname
- DB_PORT=3306
- DB_USERNAME=bookstackuser
- DB_PASSWORD=
volumes:
- ./config:/config
ports:
- 6875:80
restart: unless-stopped
bookstack_db:
image: lscr.io/linuxserver/mariadb:latest
container_name: bookstack_db
environment:
- PUID=1000
- PGID=1000
- TZ=Europe/Paris
- MYSQL_ROOT_PASSWORD=
- MYSQL_DATABASE=bookstackdbname
- MYSQL_USER=bookstackuser
- MYSQL_PASSWORD=
volumes:
- ./db_config:/config
ports:
- 3308:3306
restart: unless-stopped
Thanks!
View all comments
Show parent comment
1
u/BagCompetitive357 Aug 29 '25 edited Aug 29 '25
I spent the whole day on B ookstack+CF and couldn't get them to work.
I tried all possibilities for APP_URL (http://localhost:6875, https://localhost:6875 http://mydomain.com, https://mydomain.com) with all possibilities for cloudflare settings (http://localhost:6875, https://localhost:6875, http://docker-IP:80, https://docker-IP:80), with or without NoTLSVerify enabled, with or without path /login set in CF.
For https, there is a TLS setting in CF "Origin Server Name, ostname that cloudflared should expect from your origin server certificate." which I set to defatempty, localhost, 127.0.0.1,4 bookstack, and mydomain.com.
For http, there is a setting "HTTP Host Header, Sets the HTTP Host header on requests sent to the local service" which I set to default blank or mydomain.com.
Nothing works. curl shows all of them return TLS handshake error.
CF Tunnels is a popular service. Can you run the Yaml file in my post and checkthe CF settings? CF Tunnels is simple. Create a tunnel, paste the provided command in your terminal, and specify a port!
It could be that the URL the user sends to CF is modified by CF a bit, so Bookstack refuses TLS?
More like, I doubt it works with CF tunnels without changes in the code.
Thanks!