LycheeOrg/Lychee-Docker

400 BadRequestHeaderException Invalid token

Opened this issue · 0 comments

Hi,

I'm trying to setup Lychee Docker through nginx reverse proxy but keep receiving a "400 BadRequestHeaderException Invalid token" error. Lychee seems to work fine if accessed through the local IP, but when exposed through nginx it stops working.

image

nginx config

location /lychee/ {
  proxy_pass http://127.0.0.1:90/;
  proxy_set_header Host $host;
  proxy_set_header X-Real-IP $remote_addr;
  proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
  proxy_set_header X-Forwarded-Host $host;
  proxy_set_header X-Forwarded-Proto $scheme;
}

I have also set APP_URL and TRUSTED_PROXIES on the docker container to the following but its still not working.

APP_URL=https://my.domain/lychee/
TRUSTED_PROXIES=*

The issue seems to be related to the CSRF token cookie not being set properly when proxied through nginx.

Any help to point me in the right direction would be appreciated.

Thanks!