mirror of
https://github.com/pelican-dev/panel.git
synced 2026-02-25 03:14:39 +03:00
[PR #1685] [CLOSED] Fix mixed content issues when running behind HTTPS reverse proxy #1521
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/pelican-dev/panel/pull/1685
Author: @PaulaBras
Created: 9/9/2025
Status: ❌ Closed
Base:
main← Head:main📝 Commits (3)
8804fd6Initial plan1814ab6Implement HTTPS reverse proxy support with TrustProxies middleware and enhanced URL generation61ff9ffMerge pull request #1 from PaulaBras/copilot/fix-https-reverse-proxy-asset-loading📊 Changes
6 files changed (+138 additions, -2 deletions)
View changed files
📝
.env.example(+5 -1)➕
app/Http/Middleware/TrustProxies.php(+36 -0)📝
app/Providers/AppServiceProvider.php(+12 -1)📝
bootstrap/app.php(+2 -0)📝
config/session.php(+26 -0)📝
readme.md(+57 -0)📄 Description
TL;DR PR fixes the HTTPS reverse proxy issue. For your scenario (HTTPS outside, HTTP inside container)
Problem
When deploying Pelican Panel behind an HTTPS reverse proxy (nginx, Apache, Cloudflare, etc.), the application generates HTTP asset URLs instead of HTTPS, causing browsers to block mixed content. This results in:
Mixed Content: Blocked loading mixed active content "http://example.com/css/app.css"TypeError: can't access property "then", a.default.detectStore(...) is undefinedtable is not definedandselectFormComponent is not definedRoot Cause
Laravel wasn't detecting the original HTTPS protocol from reverse proxy headers because:
X-Forwarded-ProtoheadersAPP_URLexplicitly started withhttps://Solution
1. Added TrustProxies Middleware
Created
app/Http/Middleware/TrustProxies.phpthat:X-Forwarded-Proto,X-Forwarded-Host, etc.)TRUST_PROXIESenvironment variable2. Enhanced HTTPS Detection
Modified
AppServiceProvider.phpto force HTTPS scheme when:APP_URLstarts withhttps://(existing behavior)X-Forwarded-Proto: httpsheader (new)X-Forwarded-SSL: onheader is present3. Secure Session Configuration
Added secure cookie settings to prevent session hijacking:
SESSION_SECURE_COOKIE- ensures cookies only sent over HTTPSSESSION_SAME_SITE_COOKIE- CSRF protection withlaxdefault4. Updated Environment Defaults
Changed
.env.exampleto be HTTPS-friendly by default:5. Added Documentation
Comprehensive reverse proxy setup guide in README with:
AI
yes this was made with and by AI
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.