mirror of
https://github.com/thecyberlearn/quantumtaskai-caprover.git
synced 2026-08-18 10:52:55 +00:00
HTTPS FIXES: - Added TLS/SSL configuration to dokploy.json with Let's Encrypt - Created production_https_settings.py with proper HTTPS Django settings - Added SSL redirect, HSTS headers, and secure cookie settings - Updated Dockerfile and startup script to use HTTPS settings - Added CSRF trusted origins for both HTTP and HTTPS - Configured Traefik proxy header handling SECURITY IMPROVEMENTS: - Force HTTPS redirect for production - HTTP Strict Transport Security (HSTS) enabled - Secure cookies (SESSION_COOKIE_SECURE, CSRF_COOKIE_SECURE) - XSS protection and content type sniffing prevention - Proper X-Forwarded-Proto header handling for Dokploy/Traefik This should resolve HTTPS certificate and redirect issues in Dokploy.
40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
# Production HTTPS settings for Dokploy deployment
|
|
from netcop_hub.settings import *
|
|
|
|
# Force HTTPS in production
|
|
SECURE_SSL_REDIRECT = True
|
|
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
|
|
|
|
# HSTS (HTTP Strict Transport Security)
|
|
SECURE_HSTS_SECONDS = 31536000 # 1 year
|
|
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
|
|
SECURE_HSTS_PRELOAD = True
|
|
|
|
# Cookie security
|
|
SESSION_COOKIE_SECURE = True
|
|
CSRF_COOKIE_SECURE = True
|
|
SESSION_COOKIE_HTTPONLY = True
|
|
CSRF_COOKIE_HTTPONLY = True
|
|
|
|
# Additional security headers
|
|
SECURE_CONTENT_TYPE_NOSNIFF = True
|
|
SECURE_BROWSER_XSS_FILTER = True
|
|
X_FRAME_OPTIONS = 'DENY'
|
|
|
|
# Trust Dokploy/Traefik proxy headers
|
|
USE_X_FORWARDED_HOST = True
|
|
USE_X_FORWARDED_PORT = True
|
|
|
|
# CSRF trusted origins for HTTPS
|
|
CSRF_TRUSTED_ORIGINS = [
|
|
'https://website-quantumtaskai-wrczik-cc50ac-31-97-62-205.traefik.me',
|
|
'http://website-quantumtaskai-wrczik-cc50ac-31-97-62-205.traefik.me', # For testing
|
|
'https://localhost:3000',
|
|
'http://localhost:3000',
|
|
]
|
|
|
|
print("🔒 HTTPS Production Settings Loaded")
|
|
print(f" - SSL Redirect: {SECURE_SSL_REDIRECT}")
|
|
print(f" - HSTS: {SECURE_HSTS_SECONDS} seconds")
|
|
print(f" - Trusted Origins: {len(CSRF_TRUSTED_ORIGINS)} configured")
|