Fix Paperless login redirect issue
- Configure LOGIN_REDIRECT_URL and LOGOUT_REDIRECT_URL to /paperless/ - Set proper cookie paths for session isolation (/paperless/ instead of /) - Use environment variables for redirect URLs in paperless_custom_settings.py - Add PAPERLESS_URL and PAPERLESS_FORCE_SCRIPT_NAME to env template - Ensure FORCE_SCRIPT_NAME respects environment variable This fixes the issue where logging into Paperless redirects to the root Django app instead of staying within the Paperless scope. The docker-compose.yml already has the correct environment variables set.
This commit is contained in:
@@ -42,6 +42,9 @@ PAPERLESS_SECRET_KEY=your_paperless_secret_key_here
|
||||
PAPERLESS_ADMIN_USER=admin
|
||||
PAPERLESS_ADMIN_PASSWORD=your_paperless_admin_password_here
|
||||
PAPERLESS_ADMIN_MAIL=admin@vhtv-stiftung.de
|
||||
# Paperless URL configuration for reverse proxy
|
||||
PAPERLESS_URL=https://vhtv-stiftung.de/paperless
|
||||
PAPERLESS_FORCE_SCRIPT_NAME=/paperless
|
||||
|
||||
# GRAMPS WEB CONFIGURATION
|
||||
GRAMPSWEB_SECRET_KEY=your_grampsweb_secret_key_here
|
||||
|
||||
@@ -10,9 +10,18 @@ SESSION_COOKIE_NAME = 'paperless_sessionid'
|
||||
# Also change CSRF cookie name for good measure
|
||||
CSRF_COOKIE_NAME = 'paperless_csrftoken'
|
||||
|
||||
# Ensure cookies are scoped to avoid conflicts
|
||||
SESSION_COOKIE_PATH = '/'
|
||||
CSRF_COOKIE_PATH = '/'
|
||||
# Scope cookies to Paperless path to avoid conflicts
|
||||
SESSION_COOKIE_PATH = '/paperless/'
|
||||
CSRF_COOKIE_PATH = '/paperless/'
|
||||
|
||||
# Different secret key salt to ensure session isolation
|
||||
SESSION_COOKIE_SALT = 'paperless.sessions'
|
||||
SESSION_COOKIE_SALT = 'paperless.sessions'
|
||||
|
||||
# Fix login redirect to stay within Paperless scope
|
||||
# Use environment variable if set, otherwise default to /paperless/
|
||||
LOGIN_REDIRECT_URL = os.getenv('PAPERLESS_LOGIN_REDIRECT_URL', '/paperless/')
|
||||
LOGOUT_REDIRECT_URL = os.getenv('PAPERLESS_LOGOUT_REDIRECT_URL', '/paperless/')
|
||||
LOGIN_URL = '/paperless/accounts/login/'
|
||||
|
||||
# Ensure Force Script Name for proper URL handling behind proxy
|
||||
FORCE_SCRIPT_NAME = os.getenv('PAPERLESS_FORCE_SCRIPT_NAME', '/paperless')
|
||||
Reference in New Issue
Block a user