502 Bad Gateway / 499 Client Closed Request

Hi,

I am running Invoice Ninja for ~1,5 years. Since I upgraded some days ago ~4 minor versions, I can not access the service anymore.

It is running in Docker.

Browser says

502 Bad Gateway

NGinx Docker log says (mind the 499 code!)

172.18.0.4 - - [14/Apr/2024:16:31:29 +0000] “GET / HTTP/1.1” 499 0 “-” “Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:124.0) Gecko/20100101 Firefox/124.0” “[real IP redacted]”

Invoice App log says (mind the 200 code!)

172.30.0.3 - 14/Apr/2024:16:31:27 +0000 “GET /index.php” 200

env file says [xxx = redacted content]

APP_ENV=‘production’
APP_DEBUG=true
APP_URL=https://invoice.xxxxx
APP_KEY=base64:xxx
APP_LOCALE=de
IS_DOCKER=true
REQUIRE_HTTPS=false
PHANTOMJS_PDF_GENERATION=false
PDF_GENERATOR=snappdf
TRUSTED_PROXIES=‘*’
QUEUE_CONNECTION=database
DB_HOST=mysql
DB_PORT=3306
DB_DATABASE=xxx
DB_USERNAME=xxx
DB_PASSWORD=xxx

docker-compose.yml reads (do not know how to fix the indent in this editor …)

services:
server:
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
networks:
- invoiceninjanet
- traefiknet
labels:
- traefik.enable=true
- traefik.http.routers.invoiceninja-rtr-extern.entrypoints=websecure
- traefik.http.routers.invoiceninja-rtr-extern.rule=Host(invoice.xxx)
- traefik.http.routers.invoiceninja-rtr-extern.tls=true
- traefik.http.routers.invoiceninja-rtr-extern.tls.certresolver=le
- traefik.http.routers.invoiceninja-rtr-extern.middlewares=mid-chain-noauth@file
- traefik.http.routers.invoiceninja-rtr-extern.service=invoiceninja-svc@docker
# Service
- traefik.http.services.invoiceninja-svc.loadbalancer.server.port=80
app:
image: invoiceninja/invoiceninja:latest
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
networks:
- invoiceninjanet
- mysqlnet
- redisnet
networks:
invoiceninjanet:
driver: bridge
traefiknet:
name: traefiknet
external: true
mysqlnet:
name: mysqlnet
external: true
redisnet:
name: redisnet
external: true

Please help.

Adding some information:

Web Browser’s Console says:

Uncaught (in promise) TypeError: Failed to fetch
at onlineFirst (flutter_service_worker.js?v=5.8.43:459:5)
at flutter_service_worker.js?v=5.8.43:406:12

For analysis I changed the configuration so that NGinx has direct http access to the internet via port 8080 (avoiding Traefik as in the original setup).

Now it says, Client side, accessing http://invoice.XXXX:8080/index.php

404 Not found – nginx/1.25.4

NGinx Docker log:

2024/04/15 11:17:53 [error] 29#29: *20 open() “/usr/share/nginx/html/index.php” failed (2: No such file or directory), client: [IP6 redacted], server: localhost, request: “GET /index.php HTTP/1.1”, host: “invoice.XXX:8080”

If accessing http://invoice.XXXX:8080/

Welcome to nginx!
If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.com.
Thank you for using nginx.

I managed to get it running w/o Traefik on port 8080.

Currently I suspect it to be a problem with Traefik and/or Docker, maybe some changes with IPv6. It seems not being related to Invoice Ninja itself.

Confirmed:
It was a bug on the side of Traefik v2.11.1 - Timeouts were set incorrectly. Is fixed with Traefik v2.11.2 (see Release v2.11.2 · traefik/traefik · GitHub)

Was not releated to InvoiceNinja, however InvoiceNinja was affected.