Client portal not using APP_URL

Version: v5.10.31

Environment: Docker

Problem: Client portal not working

IN does work fine behind reverse proxy. The IN client portal however is not working. Images and CSS Files use the internal Proxy-URL of the Docker-Container (http://127.0.0.1:8888) within the delivered html data in browser and so the Client portal presentation is broken.

This is my env - file (the relevant part of it):

# IN application vars
APP_URL=https://external.domain.tld
APP_KEY=base64:$valid.app.key=
APP_DEBUG=true
REQUIRE_HTTPS=false
PHANTOMJS_PDF_GENERATION=false
PDF_GENERATOR=snappdf
TRUSTED_PROXIES='*'

My docker-compose.yml:

version: '3.7'

services:
  server:
    container_name: ninja_web
    image: nginx
    restart: always
    env_file: env
    volumes:
      - ./config/nginx/in-vhost.conf:/etc/nginx/conf.d/in-vhost.conf:ro
      - ./docker/app/public:/var/www/app/public:ro
    depends_on:
      - app
    ports:
      - "127.0.0.1:8888:80"
    networks:
      - invoiceninja

  app:
    container_name: ninja_app
    image: invoiceninja/invoiceninja:5
    env_file: env
    restart: always
    volumes:
      - ./config/hosts:/etc/hosts:ro
      - ./docker/app/public:/var/www/app/public:rw,delegated
      - ./docker/app/storage:/var/www/app/storage:rw,delegated
      - ./config/php/php.ini:/usr/local/etc/php/php.ini
      - ./config/php/php-cli.ini:/usr/local/etc/php/php-cli.ini

    depends_on:
      - db
    networks:
      - invoiceninja

  db:
    container_name: ninja_db
    image: mysql:8
    restart: always
    env_file: env
    volumes:
      - ./docker/mysql/data:/var/lib/mysql:rw,delegated
      - ./docker/mysql/bak:/backups:rw
      - ./config/mysql/backup-script:/etc/cron.daily/daily:ro
      - ./config/mysql/backup-script:/etc/cron.weekly/weekly:ro
      - ./config/mysql/backup-script:/etc/cron.monthly/monthly:ro
    networks:
      - invoiceninja

networks:
  invoiceninja:

Workaround: configure text-replace in nginx-Config on the host:

server {

    listen 1.2.3.4:80;
    server_name external.domain.tld;
    return 301 https://$host$request_uri;

}

server {
    listen              1.2.3.4:443 ssl;
    server_name         external.domain.tld;
    ssl_certificate     /etc/ssl/private/external.domain.tld/bundle.pem;
    ssl_certificate_key /etc/ssl/private/external.domain.tld/external.domain.tld.key;
    ssl_protocols       TLSv1 TLSv1.1 TLSv1.2 TLSv1.3;
    ssl_ciphers         HIGH:!aNULL:!MD5;
    root /var/www/empty;

    location / {
        proxy_pass http://127.0.0.1:8888;
        sub_filter_once off;
        sub_filter_types text/html;
        sub_filter "http://127.0.0.1:8888" "https://external.domain.tld";
    }
}

With this workaround, the client portal works fine. But this is obviously not a clean way to configure it.

I’m expecting that the links and content elements within the client portal use the APP_URL environment variable from the docker configuration. Or is my configuration wrong?

Here’s a link to the incorrect html output:

https://nopaste.debianforum.de/42229

Hi,

I suggest asking in a discussion on GitHub

Thanks. Done.

Discussion URL on github: