Bookstack behind letsencrypt, subfolder

Hello.
I am using letsencrypt docker, successfully set up as a reverse proxy with subdirectory configs. Everything is working good, exept that I have problems with bookstack behind the letsencrypt reverse proxy. It shows only the site without the css (?)
Here is a picture:


Here is my docker-compose file:

  bookstack:
    image: linuxserver/bookstack
    container_name: bookstack
    environment:
      - PUID=1000
      - PGID=1001
      - DB_HOST=bookstack_db
      - DB_USER=bookstack
      - DB_PASS=<password>
      - DB_DATABASE=bookstackapp
      - APP_URL=https://subdomain.domain.com/bookstack
    volumes:
      - /tank/docker/bookstack:/config
    ports:
      - 6875:80
    restart: unless-stopped
    depends_on:
      - bookstack_db
  bookstack_db:
    image: linuxserver/mariadb
    container_name: bookstack_db
    environment:
      - PUID=1000
      - PGID=1001
      - MYSQL_ROOT_PASSWORD=<password>
      - TZ=Europe/Oslo
      - MYSQL_DATABASE=bookstackapp
      - MYSQL_USER=bookstack
      - MYSQL_PASSWORD=<password>
    volumes:
      - /tank/docker/bookstack:/config
    restart: unless-stopped

I have all the services I have hostet at home on my subdomain, and every docker container behind a subdirectory.

Since letsencrypt docker comtainer doesn’t come with a bookstack proxy config, I wrote one myself. I’m not very good at nginx proxying, but used another service as a template. Here it is:

fyksen@fyksen-desktop:/tank/docker$ cat nginx/nginx/proxy-confs/bookstack.subfolder.conf
# set the CONTEXT_PATH variable to /booksonic in airsonic container.

location ^~ /bookstack {
    # enable the next two lines for http auth
    #auth_basic "Restricted";
    #auth_basic_user_file /config/nginx/.htpasswd;

    # enable the next two lines for ldap auth, also customize and enable ldap.conf in the default conf
    #auth_request /auth;
    #error_page 401 =200 /login;

    include /config/nginx/proxy.conf;
    resolver 127.0.0.11 valid=30s;
    set $upstream_bookstack bookstack;
    proxy_pass http://$upstream_bookstack:80;
}

From LAN, the service works correctly on hostip:6875

have you changed the .env file which should be in var/www/bookstack/ to add the APP_URL parameter?

Thanks for the reply.
Yeah, I have tried setting the .env app_url aswell.
I have tried with both setting the app_url in docker-compose and in .env.
Only in .env, and only in docker-compose.

Nothing seems to change the behaviour.

Hello!

Sorry for reviving this old thread, but I seem to have the exact same problem. @fyksen were you able to solve it in the meantime?

Try adding

  proxy_set_header Host $host;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-Host $server_name;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-Forwarded-Proto $scheme;
  proxy_set_header X-Forwarded-Ssl on;

I also get the same problem previously
Those line really help

those are already globally present in swag, with the exception of
proxy_set_header X-Forwarded-Host $server_name;
ours is
proxy_set_header X-Forwarded-Host $host;

I’m having this issue as well. Running on UnRAID. Bookstack is installed in a container, and NGINX Proxy Manager is installed in a separate container on the same custom network.


This is the command that it runs to start the docker:
docker run -d --name=‘bookstack’ --net=‘proxynet’ -e TZ=“America/New_York” -e HOST_OS=“Unraid” -e ‘DB_HOST’=‘192.168.1.238:3306’ -e ‘DB_USER’=‘bookstack’ -e ‘DB_PASS’=‘password’ -e ‘DB_DATABASE’=‘bookstack’ -e ‘APP_URL’=‘192.168.1.238:6875’ -e ‘PUID’=‘99’ -e ‘PGID’=‘100’ -e ‘UMASK’=‘022’ -p ‘6875:80/tcp’ -v ‘/mnt/user/appdata/bookstack’:‘/config’:‘rw’ ‘linuxserver/bookstack:v21.11.1-ls172’

This is the only configuration that “works.” And by work I mean gives me that weird login page, and when i put in username: admin@admin.com password: password it gives me this error:

Oops! An Error Occurred

The server returned a “405 Method Not Allowed”.

Something is broken. Please let us know what you were doing when this error occurred. We will fix it as soon as possible. Sorry for any inconvenience caused.

Bookstack logfile:

[s6-init] making user provided files available at /var/run/s6/etc…exited 0.
[s6-init] ensuring user provided files have correct perms…exited 0.
[fix-attrs.d] applying ownership & permissions fixes…
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts…
[cont-init.d] 01-envfile: executing…
[cont-init.d] 01-envfile: exited 0.
[cont-init.d] 10-adduser: executing…


_ ()
| | ___ _ __
| | / | | | /
| | _
\ | | | () |
|| |
/ || __/

Brought to you by linuxserver.io

To support LSIO projects visit:
Donate | LinuxServer.io

GID/UID

User uid: 99
User gid: 100

[cont-init.d] 10-adduser: exited 0.
[cont-init.d] 20-config: executing…
[cont-init.d] 20-config: exited 0.
[cont-init.d] 30-keygen: executing…
using keys found in /config/keys
[cont-init.d] 30-keygen: exited 0.
[cont-init.d] 50-config: executing…
New container detected. Setting up app folder and fixing permissions.
App Key found - setting variable for seds
Running config - db_user set
**** APP_URL in /config/www/.env is being updated from 172.18.0.1 to 192.168.1.238 ****
**** If this is an existing install, you should run the following line from your host terminal to update the database URL entries: ****


docker exec -it bookstack php /var/www/html/artisan bookstack:update-url 172.18.0.1 192.168.1.238


nc: getaddrinfo: Name does not resolve
nc: getaddrinfo: Name does not resolve
nc: getaddrinfo: Name does not resolve
nc: getaddrinfo: Name does not resolve
nc: getaddrinfo: Name does not resolve
nc: getaddrinfo: Name does not resolve
Nothing to migrate.
[cont-init.d] 50-config: exited 0.
[cont-init.d] 90-custom-folders: executing…
[cont-init.d] 90-custom-folders: exited 0.
[cont-init.d] 99-custom-files: executing…
[custom-init] no custom files found exiting…
[cont-init.d] 99-custom-files: exited 0.
[cont-init.d] done.
[services.d] starting services
[services.d] done.

You need to set the app_url variable in the bookstack template to the address you’re going to access it via reverse proxy.

I actually stopped Nginx Proxy Manager with the same result.