mirror of
https://github.com/pelican-dev/panel.git
synced 2026-02-24 03:12:01 +03:00
Docker image will not serve on HTTP if the site URL is https #257
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?
Originally created by @Morpheus636 on GitHub (Feb 12, 2025).
Originally assigned to: @parkervcp on GitHub.
Current Behavior
The Caddyfile uses the
SITE_URLenvironment variable to set the route on which Caddy will serve the panel.If you place the panel behind a reverse proxy that provides and terminates TLS (such as a different Caddy instance used to serve multiple sites),
SITE_URLis supposed to start with https://.With SITE_URL beginning https://, Caddy will redirect any traffic on port 80 (including from the reverse proxy server in front of it) to 443, causing too many redirects.
Expected Behavior
Caddy allow the site to be served on HTTP or HTTPS, regardless of the
SITE_URL.Steps to Reproduce
To reproduce the redirect behavior:
To reproduce the too many redirects error:
Panel Version
v1.0.0-beta17
Wings Version
N/A
Games and/or Eggs Affected
N/A
Docker Image
N/A
Error Logs
Is there an existing issue for this?
@Morpheus636 commented on GitHub (Feb 12, 2025):
Other notes:
http://prevents the redirects, but causes errors when the site is served on HTTPS by the proxy, because the panel will attempt to access assets via HTTP.Possible solutions:
I'm happy to open a pull request for either of the first 2 options, if there's a consensus about which one to implement.
Option 1: HTTP Catch-all
Change the Caddyfile built into the image to include an
http://catch-all rule. This can be done fairly easily, but requires disabling the implicit http->https redirect, as Caddy processes the redirect before the catch-all rule. sourceThis could have security implications (in that users could access the panel without SSL) but administrators could solve them by not forwarding port 80. That would cause connection refused errors should someone explicitly specify http://, should not affect modern browsers that use HTTPS by default.
Example (this is what I've used in my test deployment):
Option 2: New Environment Variable
Create a new environment variable, such as
SERVE_ON, to use instead ofAPP_URLonly in the Caddyfile. The new variable could default toAPP_URLif not specified, to avoid requiring additional configuration for "normal" installs.Option 3: Document SKIP_CADDY
Document that running the panel behind a proxy that terminates TLS will not work and that users who want to do so should use
SKIP_CADDY. Personally, this is my last choice; the other two options are relatively simple to implement, require little to no ongoing work from maintainers, and give the user more flexibility.@SirEndii commented on GitHub (Feb 12, 2025):
I've enabled caddy and served container port 80 to host port 9001 with a custom caddy file
I am not an expert on this - this is just how I did it/how someone recommended to me to do it
See https://github.com/pelican-dev/panel/discussions/967 if you are interested (Or even maybe you see some issue with that deployment)
@Morpheus636 commented on GitHub (Feb 12, 2025):
That's the Option 3 I listed (use SKIP_CADDY and host entirely with an external web server). It is a valid workaround, but I would much prefer to keep the panel container self-contained and reverse proxy to its built-in webserver.
@SirEndii commented on GitHub (Feb 12, 2025):
I agree at this point
@kevinsnijder commented on GitHub (Feb 17, 2025):
I have the same problem, currently unable to make an NGINX reverse proxy to the pelican panel.
Edit: Fixed it with the caddyfile @Morpheus636 provided
@redthirten commented on GitHub (Mar 13, 2025):
I just wanted to confirm this issue as well. Was trying to place the panel behind a Traefik reverse proxy that provides and terminates TLS for multiple sites, but ran into a slew of confusing issues:
SKIP_CADDY: truethinking the container's internal Caddy instance was only providing a reverse proxy service. I had no idea it was also providing the webserver for php-fpm until I Googled php-fpm and learned it wasn't the webserver itself.APP_URLto "https://mydomain.com, http://, https://". This got the panel working and connectable, but broke the SMTP Mail Driver because it was setting the HELO/EHLO argument to "mydomain.com, http", which my mail server denied.TRUSTED_PROXIESenvironment variable, but I think it's broken? The panel expects this value to be an array, so setting it simply to "127.0.0.1" gives a 500 error on the admin settings page for providing a string when an array is expected. I'm not sure how to specify an array in my docker-compose file that would translate to a php-accepted array value.@Lovinoes commented on GitHub (Mar 30, 2025):
I want to confirm this issue as well. I experienced the same problems while using NGINX as a reverse proxy instead of Traefik. It only works when setting the APP_URL to HTTP instead of HTTPS, which seems counterintuitive. The same problems with SKIP_CADDY, TRUSTED_PROXIES, and SMTP also occurred in my setup