Paperless via reverse proxy, CSRF verification error

I’ve installed and configured paperless, and it is working fine locally. I’ve then configured a reverse proxy so I can access Paperless from outside.
from outside, I get to the login page, but once I sign in, I get a 403 error with the message “CSRF verification failed. Request aborted.”
I’m assuming this is because I’ve not set PAPERLESS_URL correctly.

So here’s my real issue. Where do I configure the value for it?
I’ve tried to set it in the truenas paperless configuration as an environment variable, but it makes no difference. Is there a different place I should set it?

I’ve come across a similar problem. I’ve set up the environment variable to my url - strange here I can connect via an app on iOS (paperparrot) but not via Safari browser or another app (less paper). hope someone can help here

Having a look at my configuration and paperless has a .env that has among other settings

PAPERLESS_URL - https://paper.mydomain-name

And

PAPERLESS_CSRF_TRUSTED_ORIGINS - https://paper.mydomain-name

I’ve only ever used it with these settings as above and can confirm it works,

I’m not sure if ther may be an issue with where* you are placing the .env file, maybe paperless cant find it? I’ve it setup in Portainer with the .env file uploaded ther

You don’t need an .env file if you are using the standard TrueNAS app for Paperless-NGX. You can set arbitrary environment variables in the UI.

For a reverse proxy you need PAPERLESS_URL and PAPERLESS_TRUSTED_PROXIES.

You can set more things that way like PAPERLESS_EMAIL_HOST for example.

For a full reference look here:
https://paperless-ngx.readthedocs.io/en/ng-1.5.0/configuration.html

So I’ve found the solution for the graphical UI:
go to your apps, mark paperless and click the Edit button, then add these:

in nginx (my reverse proxy) I added this to “advanced” on my paperless subdomain:

proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header Host $host;#

PAPERLESS_URL and PAPERLESS_TRUSTED_PROXIES is sufficient here.

Blockquote PAPERLESS_URL and PAPERLESS_TRUSTED_PROXIES is sufficient here.

Hi,

after edit the app with this, the app doesn’t come up again. As the Proxy ist put the IP of my TrueNAS, becaus here runs the nginx.

Any ideas whats going wrong?

The Container Log shows this:
2025-06-16 16:59:50.360309+00:00[init-start] paperless-ngx docker container starting…

2025-06-16 16:59:50.369481+00:00[init-start] paperless-ngx docker container starting init as root

2025-06-16 16:59:50.382402+00:00[env-init] Checking for environment from files

2025-06-16 16:59:50.387207+00:00[env-init] No *_FILE environment found

2025-06-16 16:59:50.400789+00:00[init-tesseract-langs] Checking if additional teseract languages needed

2025-06-16 16:59:50.401354+00:00[init-db-wait] Waiting for postgresql to report ready

2025-06-16 16:59:50.401384+00:00[init-tesseract-langs] No additional installs requested

2025-06-16 16:59:50.401424+00:00[init-db-wait] Waiting for PostgreSQL to start…

2025-06-16 16:59:50.401443+00:00[init-redis-wait] Waiting for Redis to report ready

2025-06-16 16:59:50.407104+00:00[init-user] Mapping UID for paperless to 568

2025-06-16 16:59:51.310996+00:00Waiting for Redis…

2025-06-16 16:59:51.318944+00:00Connected to Redis broker.

2025-06-16 16:59:51.345381+00:00[init-redis-wait] Redis ready

2025-06-16 16:59:55.612473+00:00Connected to PostgreSQL

2025-06-16 16:59:55.612583+00:00[init-db-wait] Database is ready

Solved - I did a reinstall. Now ist works fine, the external access also.