BookStack icon indicating copy to clipboard operation
BookStack copied to clipboard

Unable to Enable APP_PROXIES Setting in Docker Compose for Nginx Reverse Proxy and BookStack

Open Sazzels opened this issue 10 months ago • 0 comments

Attempted Debugging

  • [X] I have read the debugging page

Searched GitHub Issues

  • [X] I have searched GitHub for the issue.

Describe the Scenario

When attempting to enable the APP_PROXIES setting in the Docker Compose configuration for Nginx reverse proxy and BookStack, the services fail to function as expected. Despite configuring Nginx as a reverse proxy for BookStack and setting up the necessary environment variables, the interaction between the containers doesn't seem to be established correctly.

Additional Details:

  • Nginx reverse proxy and BookStack are deployed using Docker Compose.
  • The APP_PROXIES setting is enabled in the Docker Compose configuration.
  • Nginx is configured to act as a reverse proxy for BookStack.
  • Both containers are on the same Docker network.
  • Logs from both Nginx and BookStack containers don't provide clear indications of the underlying issue.
  • There are no obvious misconfigurations in the environment variables or configuration files.

I have tried to add all the information about the environment, but can certainly add more if necessary. Unfortunately, I could not get the real IP within the access logs of bookstack set correctly.

All of the APP_PROXIES comments in the docker-compose.yml below did not work.

Related issue: https://github.com/BookStackApp/BookStack/issues/2964

Exact BookStack Version

24.02.2

Log Content

log/nginx/access.log 172.25.0.4 - - [09/Apr/2024:20:02:14 +0000] "GET / HTTP/1.1" 200 9278 "<reverseProxyFQDN>" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0"

docker-compose.yml (Bookstack)

services:
  bookstack:
    image: "linuxserver/bookstack:24.02.2"
    container_name: bookstack
    hostname: docs.<DOMAIN>
    restart: unless-stopped
    networks:
      - proxy
      - docs
    depends_on:
      - bookstack_db
    environment:
      # APP URL
      - APP_URL=https://docs.<DOMAIN>
      # PROXY
      # - APP_PROXIES=*
      # - APP_PROXIES=172.25.0.4
      # - APP_PROXIES=172.25.0.0/16
      # - APP_PROXIES=<PROXY_IP>
      # DATABASE
      - DB_HOST=bookstack_db
      - DB_USER=bookstack
      - DB_PASS=<DB_PASS>
      - DB_DATABASE=bookstack_db
      # SMTP
      - ...
    volumes:
      - "/home/docs/data:/config"
  bookstack_db:
    image: "linuxserver/mariadb:10.11.6"
    container_name: bookstack_db
    hostname: mariadb-bookstack.<DOMAIN>
    restart: unless-stopped
    networks:
      - docs
    environment:
      - MYSQL_ROOT_PASSWORD=<MYSQL_ROOT_PASSWORD>
      - TZ=Europe/Berlin
      - MYSQL_DATABASE=bookstack_db
      - MYSQL_USER=bookstack
      - MYSQL_PASSWORD=<MYSQL_PASSWORD>
    volumes:
      - "/home/docs/mariadb:/config"
      - "/home/docs/mariadb-dumps:/var/lib/mysql-dumps"

networks:
  docs:
    name: docs
    external: true
  proxy:
    external: true

docker-compose.yml (Proxy)

services:
  proxy:
    image: 'jc21/nginx-proxy-manager:2.11.1'
    container_name: proxy
    hostname: npm.<DOMAIN>
    restart: always
    networks:
      - proxy
    ports:
      - '80:80'
      - '81:81'
      - '443:443'
    volumes:
      - "/home/proxy/data:/data"
      - "/home/proxy/letsencrypt:/etc/letsencrypt"

networks:
  proxy:
    external: true

Proxy network: 172.25.0.0/16

grafik

Hosting Environment

docker version: 26.0.0

Sazzels avatar Apr 09 '24 19:04 Sazzels