// troubleshooting guide · seafile

Seafile 403 CSRF Verification Failed

Status
Workaround available
platforms:
Web (self-hosted server)
updated:
November 16, 2026
reports:
6
Method
how we research
Share

RUNBOOK · seafile/csrf-verification-failed4 FIXES

// quick answer

Seafile 11+ uses a newer Django that checks the Origin header strictly. Set CSRF_TRUSTED_ORIGINS to your exact URL with https://, fix any doubled 'http://https://', and make your reverse proxy pass Host and X-Forwarded-Proto.

Most likely fix: Set CSRF_TRUSTED_ORIGINS correctly

How to fix it

// try these in order, the most common fix is first

  1. FIX 1Set CSRF_TRUSTED_ORIGINS correctly

    1. 01Open seahub_settings.py (Docker: seafile_data/seafile/conf/seahub_settings.py)
    2. 02Add or edit: CSRF_TRUSTED_ORIGINS = ['https://files.example.com'] using your exact public URL with scheme
    3. 03Restart the Seafile container or seahub
    Did this fix it?
  2. FIX 2Remove the doubled protocol

    1. 01Search seahub_settings.py for 'http://https://'
    2. 02Replace it with 'https://'
    3. 03Restart Seafile
    Did this fix it?
  3. FIX 3Forward the right headers from your proxy

    1. 01Nginx: in the Seahub location add proxy_set_header Host $http_host; and proxy_set_header X-Forwarded-Proto $scheme;
    2. 02HAProxy: add http-request set-header X-Forwarded-Proto https on the HTTPS frontend
    3. 03Reload the proxy and clear browser cookies for the site
    Did this fix it?
  4. FIX 4Find the exact rejection reason

    1. 01Temporarily set DEBUG = True in seahub_settings.py and restart
    2. 02Reproduce the login; the error page shows which origin or referer was rejected
    3. 03Check seahub.log for the same message, then set DEBUG back to False
    Did this fix it?

SANDBOX · seafile RUNS IN YOUR BROWSER

Try it: upload, share and sync files between the web and your laptop

A hands-on Seafile-style sandbox, including the spots where users get stuck. See where problems like this one start. 1-2 minutes, nothing is saved.

Symptoms

Logging in or submitting a form shows 'Forbidden (403) CSRF verification failed. Request aborted.', often right after an upgrade or after putting Seafile behind a new proxy.

Why it happens

  • C-01Newer Django (Seafile 11+) enforces Origin/Referer checks against trusted origins
  • C-02CSRF_TRUSTED_ORIGINS missing the scheme (https://)
  • C-03Docker setup writing a doubled 'http://https://' into seahub_settings.py
  • C-04Reverse proxy not forwarding the Host or X-Forwarded-Proto header
  • C-05Seafile served under a subpath such as /seafile

// this guide also covers

  • seafile csrf verification failed
  • seafile 403 forbidden
  • seafile csrf_trusted_origins
  • seafile docker csrf error

Still not working?

If Seafile keeps failing, you're not alone. See every Seafile problem users report or the alternatives people switch to.

Have an app idea? Our small team builds any software: web and mobile apps, games, desktop, AI tools. Price agreed together.

Talk to us

Watch Seafile Get an email when its price changes, it has an outage, or we publish a new fix. No spam.

Fixed it? Share this guide

The same problem in other apps

All login, account & activation guides →

Other Seafile errors

All 11 Seafile errors and fixes →