Dont know why i get 502

{"level":"info","ts":1752947469.0494325,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}
{"level":"info","ts":1752947469.0500784,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0x4000767480"}
{"level":"info","ts":1752947469.0502143,"logger":"http.auto_https","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
{"level":"debug","ts":1752947469.0502799,"logger":"http.auto_https","msg":"adjusted config","tls":{"automation":{"policies":[{"subjects":["hls.mooncore.online"]},{}]}},"http":{"servers":{"remaining_auto_https_redirects":{"listen":[":80"],"routes":[{},{}]},"srv0":{"listen":[":443"],"routes":[{"handle":[{"handler":"subroute","routes":[{"handle":[{"handler":"reverse_proxy","upstreams":[{"dial":"portainer:8000"}]}]}]}],"terminal":true}],"tls_connection_policies":[{"match":{"sni":["hls.mooncore.online"]},"protocol_min":"tls1.3"},{}],"automatic_https":{},"trusted_proxies":{"interval":43200000000000,"source":"cloudflare","timeout":15000000000},"client_ip_headers":["Cf-Connecting-Ip","X-Forwarded-For"]}}}}
{"level":"debug","ts":1752947469.0616946,"logger":"http","msg":"starting server loop","address":"[::]:443","tls":true,"http3":false}
{"level":"info","ts":1752947469.0618055,"logger":"http","msg":"enabling HTTP/3 listener","addr":":443"}
{"level":"info","ts":1752947469.0623374,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]}
{"level":"debug","ts":1752947469.0731328,"logger":"http","msg":"starting server loop","address":"[::]:80","tls":false,"http3":false}
{"level":"warn","ts":1752947469.0732257,"logger":"http","msg":"HTTP/2 skipped because it requires TLS","network":"tcp","addr":":80"}
{"level":"warn","ts":1752947469.07324,"logger":"http","msg":"HTTP/3 skipped because it requires TLS","network":"tcp","addr":":80"}
{"level":"info","ts":1752947469.0732505,"logger":"http.log","msg":"server running","name":"remaining_auto_https_redirects","protocols":["h1","h2","h3"]}
{"level":"info","ts":1752947469.073268,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["hls.mooncore.online"]}
{"level":"warn","ts":1752947469.074425,"logger":"tls","msg":"stapling OCSP","error":"no OCSP stapling for [hls.mooncore.online]: no OCSP server specified in certificate","identifiers":["hls.mooncore.online"]}
{"level":"debug","ts":1752947469.074709,"logger":"tls.cache","msg":"added certificate to cache","subjects":["hls.mooncore.online"],"expiration":1760561508,"managed":true,"issuer_key":"acme-v02.api.letsencrypt.org-directory","hash":"a98bd36964ed643bdc4e067efde6403dad9d50c44c76c0dbeda87a709ee07397","cache_size":1,"cache_capacity":10000}
{"level":"debug","ts":1752947469.0747786,"logger":"events","msg":"event","name":"cached_managed_cert","id":"4c65e182-154c-4b61-8c58-0b7dc45d218b","origin":"tls","data":{"sans":["hls.mooncore.online"]}}
{"level":"debug","ts":1752947469.0748978,"logger":"events","msg":"event","name":"started","id":"3d5e50bd-d21c-499c-ade3-d30f43e21d0f","origin":"","data":null}
{"level":"info","ts":1752947469.0753186,"msg":"autosaved config (load with --resume flag)","file":"/config/caddy/autosave.json"}
{"level":"info","ts":1752947469.082699,"logger":"tls","msg":"storage cleaning happened too recently; skipping for now","storage":"FileStorage:/data/caddy","instance":"cd81ee90-5bf9-4c33-b4a3-a373c1b74f6b","try_again":1753033869.0826943,"try_again_in":86399.999998444}
{"level":"info","ts":1752947469.0830307,"logger":"tls","msg":"finished cleaning storage units"}
{"level":"debug","ts":1752947469.6002495,"msg":"http request","method":"GET","url":"https://acme-v02.api.letsencrypt.org/directory","headers":{"User-Agent":["Caddy/2.10.0 CertMagic acmez (linux; arm64)"]},"response_headers":{"Cache-Control":["public, max-age=0, no-cache"],"Content-Length":["995"],"Content-Type":["application/json"],"Date":["Sat, 19 Jul 2025 17:51:09 GMT"],"Server":["nginx"],"Strict-Transport-Security":["max-age=604800"],"X-Frame-Options":["DENY"]},"status_code":200}
{"level":"debug","ts":1752947469.6006489,"msg":"getting renewal info","names":["hls.mooncore.online"]}
{"level":"debug","ts":1752947469.7897792,"msg":"http request","method":"GET","url":"https://acme-v02.api.letsencrypt.org/acme/renewal-info/nytfzzwhT50Et-0rLMTGcIvS1w0.BnUC68ZX27n5BHeVm76YDA10","headers":{"User-Agent":["Caddy/2.10.0 CertMagic acmez (linux; arm64)"]},"response_headers":{"Cache-Control":["public, max-age=0, no-cache"],"Content-Length":["101"],"Content-Type":["application/json"],"Date":["Sat, 19 Jul 2025 17:51:09 GMT"],"Link":["<https://acme-v02.api.letsencrypt.org/directory>;rel=\"index\""],"Retry-After":["21600"],"Server":["nginx"],"Strict-Transport-Security":["max-age=604800"],"X-Frame-Options":["DENY"]},"status_code":200}
{"level":"info","ts":1752947469.7899947,"msg":"got renewal info","names":["hls.mooncore.online"],"window_start":1757892952,"window_end":1758048402,"selected_time":1758004828,"recheck_after":1752969069.7899718,"explanation_url":""}
{"level":"info","ts":1752947469.7979627,"logger":"tls","msg":"updated and stored ACME renewal information","identifiers":["hls.mooncore.online"],"cert_hash":"a98bd36964ed643bdc4e067efde6403dad9d50c44c76c0dbeda87a709ee07397","ari_unique_id":"nytfzzwhT50Et-0rLMTGcIvS1w0.BnUC68ZX27n5BHeVm76YDA10","cert_expiry":1760561507,"selected_time":1757923161,"next_update":1752969069.7899718,"explanation_url":""}
{"level":"info","ts":1752947517.4273305,"msg":"shutting down","signal":"SIGINT"}
{"level":"warn","ts":1752947517.427495,"msg":"exiting; byeee!! 👋","signal":"SIGINT"}
{"level":"debug","ts":1752947517.4276755,"logger":"events","msg":"event","name":"stopping","id":"db0ecbee-a8ea-432a-9f18-1fc9784bdb36","origin":"","data":null}
{"level":"info","ts":1752947517.4278004,"logger":"http","msg":"servers shutting down with eternal grace period"}
{"level":"info","ts":1752947517.4282932,"logger":"admin","msg":"stopped previous server","address":"localhost:2019"}
{"level":"info","ts":1752947517.4284303,"msg":"shutdown complete","signal":"SIGINT","exit_code":0}
{"level":"info","ts":1752947617.153012,"logger":"admin","msg":"admin endpoint started","address":"localhost:2019","enforce_origin":false,"origins":["//localhost:2019","//[::1]:2019","//127.0.0.1:2019"]}
{"level":"info","ts":1752947617.1536715,"logger":"tls.cache.maintenance","msg":"started background certificate maintenance","cache":"0x40006e0680"}
{"level":"info","ts":1752947617.1537528,"logger":"http.auto_https","msg":"enabling automatic HTTP->HTTPS redirects","server_name":"srv0"}
{"level":"debug","ts":1752947617.1538248,"logger":"http.auto_https","msg":"adjusted config","tls":{"automation":{"policies":[{"subjects":["hls.mooncore.online"]},{}]}},"http":{"servers":{"remaining_auto_https_redirects":{"listen":[":80"],"routes":[{},{}]},"srv0":{"listen":[":443"],"routes":[{"handle":[{"handler":"subroute","routes":[{"handle":[{"handler":"reverse_proxy","upstreams":[{"dial":"portainer:8000"}]}]}]}],"terminal":true}],"tls_connection_policies":[{"match":{"sni":["hls.mooncore.online"]},"protocol_min":"tls1.3"},{}],"automatic_https":{},"trusted_proxies":{"interval":43200000000000,"source":"cloudflare","timeout":15000000000},"client_ip_headers":["Cf-Connecting-Ip","X-Forwarded-For"]}}}}
{"level":"debug","ts":1752947617.1685746,"logger":"http","msg":"starting server loop","address":"[::]:80","tls":false,"http3":false}
{"level":"warn","ts":1752947617.168715,"logger":"http","msg":"HTTP/2 skipped because it requires TLS","network":"tcp","addr":":80"}
{"level":"warn","ts":1752947617.1687353,"logger":"http","msg":"HTTP/3 skipped because it requires TLS","network":"tcp","addr":":80"}
{"level":"info","ts":1752947617.168752,"logger":"http.log","msg":"server running","name":"remaining_auto_https_redirects","protocols":["h1","h2","h3"]}
{"level":"debug","ts":1752947617.1796315,"logger":"http","msg":"starting server loop","address":"[::]:443","tls":true,"http3":false}
{"level":"info","ts":1752947617.1797252,"logger":"http","msg":"enabling HTTP/3 listener","addr":":443"}
{"level":"info","ts":1752947617.180297,"logger":"http.log","msg":"server running","name":"srv0","protocols":["h1","h2","h3"]}
{"level":"info","ts":1752947617.1804113,"logger":"http","msg":"enabling automatic TLS certificate management","domains":["hls.mooncore.online"]}
{"level":"warn","ts":1752947617.1817548,"logger":"tls","msg":"stapling OCSP","error":"no OCSP stapling for [hls.mooncore.online]: no OCSP server specified in certificate","identifiers":["hls.mooncore.online"]}
{"level":"debug","ts":1752947617.1819994,"logger":"tls.cache","msg":"added certificate to cache","subjects":["hls.mooncore.online"],"expiration":1760561508,"managed":true,"issuer_key":"acme-v02.api.letsencrypt.org-directory","hash":"a98bd36964ed643bdc4e067efde6403dad9d50c44c76c0dbeda87a709ee07397","cache_size":1,"cache_capacity":10000}
{"level":"debug","ts":1752947617.1820638,"logger":"events","msg":"event","name":"cached_managed_cert","id":"c41cea02-21c5-4e20-b881-78e17e6ac0b5","origin":"tls","data":{"sans":["hls.mooncore.online"]}}
{"level":"debug","ts":1752947617.182266,"logger":"events","msg":"event","name":"started","id":"3f4b23ad-7c83-4b32-bad8-90423b29a8d5","origin":"","data":null}
{"level":"info","ts":1752947617.1826823,"msg":"autosaved config (load with --resume flag)","file":"/config/caddy/autosave.json"}
{"level":"info","ts":1752947617.1879234,"logger":"tls","msg":"storage cleaning happened too recently; skipping for now","storage":"FileStorage:/data/caddy","instance":"cd81ee90-5bf9-4c33-b4a3-a373c1b74f6b","try_again":1753034017.1879187,"try_again_in":86399.999998407}
{"level":"info","ts":1752947617.1881692,"logger":"tls","msg":"finished cleaning storage units"}
{"level":"debug","ts":1752947620.969555,"logger":"events","msg":"event","name":"tls_get_certificate","id":"43ac734b-b2fb-45ad-aecc-aa998dd2979d","origin":"tls","data":{"client_hello":{"CipherSuites":[52393,52392,49195,49199,49196,49200,49161,49171,49162,49172,4867,4865,4866],"ServerName":"hls.mooncore.online","SupportedCurves":[4588,29,23,24,25],"SupportedPoints":"AA==","SignatureSchemes":[2052,1027,2055,2053,2054,1025,1281,1537,1283,1539,513,515],"SupportedProtos":null,"SupportedVersions":[772,771],"RemoteAddr":{"IP":"172.19.0.4","Port":39282,"Zone":""},"LocalAddr":{"IP":"172.19.0.2","Port":443,"Zone":""}}}}
{"level":"debug","ts":1752947620.96986,"logger":"tls.handshake","msg":"choosing certificate","identifier":"hls.mooncore.online","num_choices":1}
{"level":"debug","ts":1752947620.9698777,"logger":"tls.handshake","msg":"default certificate selection results","identifier":"hls.mooncore.online","subjects":["hls.mooncore.online"],"managed":true,"issuer_key":"acme-v02.api.letsencrypt.org-directory","hash":"a98bd36964ed643bdc4e067efde6403dad9d50c44c76c0dbeda87a709ee07397"}
{"level":"debug","ts":1752947620.969899,"logger":"tls.handshake","msg":"matched certificate in cache","remote_ip":"172.19.0.4","remote_port":"39282","subjects":["hls.mooncore.online"],"managed":true,"expiration":1760561508,"hash":"a98bd36964ed643bdc4e067efde6403dad9d50c44c76c0dbeda87a709ee07397"}
{"level":"debug","ts":1752947620.978981,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"portainer:8000","total_upstreams":1}
{"level":"debug","ts":1752947620.9816074,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"portainer:8000","duration":0.00242564,"request":{"remote_ip":"172.19.0.4","remote_port":"39282","client_ip":"172.19.0.4","proto":"HTTP/1.1","method":"GET","host":"hls.mooncore.online","uri":"/","headers":{"Accept-Encoding":["gzip, br"],"Cdn-Loop":["cloudflare; loops=1"],"Cookie":["REDACTED"],"Dnt":["1"],"Sec-Fetch-User":["?1"],"X-Forwarded-For":["172.19.0.4"],"Cf-Ipcountry":["PL"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"Accept-Language":["en-US,en;q=0.5"],"Cf-Visitor":["{\"scheme\":\"https\"}"],"Cf-Connecting-Ip":["37.190.179.101"],"Cf-Ray":["961c1466ced83294-WAW"],"Sec-Fetch-Dest":["document"],"Sec-Fetch-Mode":["navigate"],"Sec-Fetch-Site":["none"],"Upgrade-Insecure-Requests":["1"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0"],"Priority":["u=0, i"],"Sec-Gpc":["1"],"Cf-Warp-Tag-Id":["09afab3e-a3ca-4aa1-913b-d474d30694ee"],"X-Forwarded-Host":["hls.mooncore.online"],"X-Forwarded-Proto":["https"],"Via":["1.1 Caddy"]},"tls":{"resumed":false,"version":772,"cipher_suite":4867,"proto":"","server_name":"hls.mooncore.online"}},"headers":{"Date":["Sat, 19 Jul 2025 17:53:40 GMT"],"Content-Length":["9"],"Content-Type":["text/plain; charset=utf-8"]},"status":404}
{"level":"debug","ts":1752947621.47442,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"portainer:8000","total_upstreams":1}
{"level":"debug","ts":1752947621.4754343,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"portainer:8000","duration":0.000840268,"request":{"remote_ip":"172.19.0.4","remote_port":"39282","client_ip":"172.19.0.4","proto":"HTTP/1.1","method":"GET","host":"hls.mooncore.online","uri":"/portainer","headers":{"Cf-Ray":["961c146a1d633294-WAW"],"Cf-Warp-Tag-Id":["09afab3e-a3ca-4aa1-913b-d474d30694ee"],"Sec-Fetch-Mode":["navigate"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"X-Forwarded-Host":["hls.mooncore.online"],"Dnt":["1"],"Sec-Fetch-User":["?1"],"X-Forwarded-For":["172.19.0.4"],"Accept-Encoding":["gzip, br"],"Cdn-Loop":["cloudflare; loops=1"],"Cf-Visitor":["{\"scheme\":\"https\"}"],"Sec-Gpc":["1"],"Accept-Language":["en-US,en;q=0.5"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0"],"Priority":["u=0, i"],"X-Forwarded-Proto":["https"],"Cf-Ipcountry":["PL"],"Via":["1.1 Caddy"],"Cookie":["REDACTED"],"Sec-Fetch-Dest":["document"],"Upgrade-Insecure-Requests":["1"],"Sec-Fetch-Site":["none"],"Cf-Connecting-Ip":["37.190.179.101"]},"tls":{"resumed":false,"version":772,"cipher_suite":4867,"proto":"","server_name":"hls.mooncore.online"}},"headers":{"Date":["Sat, 19 Jul 2025 17:53:41 GMT"],"Content-Length":["9"],"Content-Type":["text/plain; charset=utf-8"]},"status":404}
{"level":"debug","ts":1752947622.1802983,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"portainer:8000","total_upstreams":1}
{"level":"debug","ts":1752947622.1813881,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"portainer:8000","duration":0.000844583,"request":{"remote_ip":"172.19.0.4","remote_port":"39282","client_ip":"172.19.0.4","proto":"HTTP/1.1","method":"GET","host":"hls.mooncore.online","uri":"/portainer","headers":{"Upgrade-Insecure-Requests":["1"],"Accept":["text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"],"Cf-Ray":["961c146e7f6f3294-WAW"],"Cookie":["REDACTED"],"Cf-Connecting-Ip":["37.190.179.101"],"Dnt":["1"],"Sec-Fetch-User":["?1"],"X-Forwarded-For":["172.19.0.4"],"X-Forwarded-Host":["hls.mooncore.online"],"Cdn-Loop":["cloudflare; loops=1"],"Sec-Fetch-Dest":["document"],"Accept-Language":["en-US,en;q=0.5"],"Accept-Encoding":["gzip, br"],"Cf-Ipcountry":["PL"],"Cf-Visitor":["{\"scheme\":\"https\"}"],"Sec-Fetch-Mode":["navigate"],"X-Forwarded-Proto":["https"],"User-Agent":["Mozilla/5.0 (X11; Linux x86_64; rv:128.0) Gecko/20100101 Firefox/128.0"],"Priority":["u=0, i"],"Via":["1.1 Caddy"],"Cf-Warp-Tag-Id":["09afab3e-a3ca-4aa1-913b-d474d30694ee"],"Sec-Fetch-Site":["none"],"Sec-Gpc":["1"]},"tls":{"resumed":false,"version":772,"cipher_suite":4867,"proto":"","server_name":"hls.mooncore.online"}},"headers":{"Date":["Sat, 19 Jul 2025 17:53:42 GMT"],"Content-Length":["9"],"Content-Type":["text/plain; charset=utf-8"]},"status":404}
{"level":"debug","ts":1752947637.8789194,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"portainer:8000","total_upstreams":1}
{"level":"debug","ts":1752947637.8797169,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"portainer:8000","duration":0.000639882,"request":{"remote_ip":"172.19.0.4","remote_port":"39282","client_ip":"172.19.0.4","proto":"HTTP/1.1","method":"GET","host":"hls.mooncore.online","uri":"/","headers":{"Cf-Ipcountry":["PL"],"X-Forwarded-For":["172.19.0.4"],"X-Forwarded-Host":["hls.mooncore.online"],"User-Agent":["curl/8.14.1"],"Accept-Encoding":["gzip, br"],"X-Forwarded-Proto":["https"],"Accept":["*/*"],"Cdn-Loop":["cloudflare; loops=1"],"Cf-Ray":["961c14d07ced3542-WAW"],"Cf-Visitor":["{\"scheme\":\"https\"}"],"Cf-Warp-Tag-Id":["09afab3e-a3ca-4aa1-913b-d474d30694ee"],"Via":["1.1 Caddy"],"Cf-Connecting-Ip":["37.190.179.101"]},"tls":{"resumed":false,"version":772,"cipher_suite":4867,"proto":"","server_name":"hls.mooncore.online"}},"headers":{"Date":["Sat, 19 Jul 2025 17:53:57 GMT"],"Content-Length":["9"],"Content-Type":["text/plain; charset=utf-8"]},"status":404}
{"level":"debug","ts":1752947640.7642026,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"portainer:8000","total_upstreams":1}
{"level":"debug","ts":1752947640.7650208,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"portainer:8000","duration":0.000656586,"request":{"remote_ip":"172.19.0.4","remote_port":"39282","client_ip":"172.19.0.4","proto":"HTTP/1.1","method":"GET","host":"hls.mooncore.online","uri":"/portainer/","headers":{"Accept-Encoding":["gzip, br"],"Cf-Ipcountry":["PL"],"Cf-Visitor":["{\"scheme\":\"https\"}"],"Cf-Warp-Tag-Id":["09afab3e-a3ca-4aa1-913b-d474d30694ee"],"Accept":["*/*"],"Cdn-Loop":["cloudflare; loops=1"],"X-Forwarded-Proto":["https"],"Cf-Connecting-Ip":["37.190.179.101"],"Via":["1.1 Caddy"],"User-Agent":["curl/8.14.1"],"Cf-Ray":["961c14e29d3b349a-WAW"],"X-Forwarded-For":["172.19.0.4"],"X-Forwarded-Host":["hls.mooncore.online"]},"tls":{"resumed":false,"version":772,"cipher_suite":4867,"proto":"","server_name":"hls.mooncore.online"}},"headers":{"Content-Type":["text/plain; charset=utf-8"],"Date":["Sat, 19 Jul 2025 17:54:00 GMT"],"Content-Length":["9"]},"status":404}
{"level":"debug","ts":1752947643.8350043,"logger":"http.handlers.reverse_proxy","msg":"selected upstream","dial":"portainer:8000","total_upstreams":1}
{"level":"debug","ts":1752947643.8358881,"logger":"http.handlers.reverse_proxy","msg":"upstream roundtrip","upstream":"portainer:8000","duration":0.000723936,"request":{"remote_ip":"172.19.0.4","remote_port":"39282","client_ip":"172.19.0.4","proto":"HTTP/1.1","method":"GET","host":"hls.mooncore.online","uri":"/portainer","headers":{"User-Agent":["curl/8.14.1"],"Cf-Ipcountry":["PL"],"Accept":["*/*"],"Cf-Visitor":["{\"scheme\":\"https\"}"],"X-Forwarded-For":["172.19.0.4"],"Cf-Warp-Tag-Id":["09afab3e-a3ca-4aa1-913b-d474d30694ee"],"X-Forwarded-Host":["hls.mooncore.online"],"Accept-Encoding":["gzip, br"],"Cdn-Loop":["cloudflare; loops=1"],"Cf-Connecting-Ip":["37.190.179.101"],"Via":["1.1 Caddy"],"Cf-Ray":["961c14f5bed2c3bb-WAW"],"X-Forwarded-Proto":["https"]},"tls":{"resumed":false,"version":772,"cipher_suite":4867,"proto":"","server_name":"hls.mooncore.online"}},"headers":{"Content-Type":["text/plain; charset=utf-8"],"Date":["Sat, 19 Jul 2025 17:54:03 GMT"],"Content-Length":["9"]},"status":404}
{"level":"info","ts":1752947650.9026546,"msg":"shutting down","signal":"SIGINT"}
{"level":"warn","ts":1752947650.90281,"msg":"exiting; byeee!! 👋","signal":"SIGINT"}
{"level":"debug","ts":1752947650.9029396,"logger":"events","msg":"event","name":"stopping","id":"e5424804-0239-49e7-89fc-b7a9941a79c0","origin":"","data":null}
{"level":"info","ts":1752947650.9029891,"logger":"http","msg":"servers shutting down with eternal grace period"}
{"level":"info","ts":1752947650.904015,"logger":"admin","msg":"stopped previous server","address":"localhost:2019"}
{"level":"info","ts":1752947650.9041908,"msg":"shutdown complete","signal":"SIGINT","exit_code":0}

exit sig cuz still running with -a and set restart from until stopped to never

although now it always says not found instead of showing CF’s 502 error

Alright, so the 404 is coming from Portainer. What’s your Portainer configuration? Have you set the VIRTUAL_HOST var?

Also, does Portainer know it’s served on the subpath /portainer? This is crucial

nope and nope, i did not knew that either, as that was the command i created portainer

docker run -d --name portainer --restart unless-stopped -p 8000:8000 -p 9000:9000 -p 9443:9443 -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer-ce:linux-arm64

edit:
added handle_path to caddyfile, here’s a part

hls.mooncore.online {
        tls {
                dns cloudflare {env.CLOUDFLARE_API_TOKEN} #  for Cloudflare
                resolvers 1.1.1.1
                protocols tls1.3
        }


        # Proxy /portainer/* to Portainer on HTTPS
        handle_path /portainer/* {
                reverse_proxy portainer:8000
        }

I think im a bit closer
with caddyfile:

#Global Config
{
        debug
        email [email]
        servers {
                trusted_proxies cloudflare {
                        interval 12h
                        timeout 15s
                }
        client_ip_headers Cf-Connecting-Ip X-Forwarded-For
        }
        log default {
                level DEBUG
                output file /var/log/caddy/caddy.log
        }
}

# Serve everything through hls.mooncore.online on HTTPS
hls.mooncore.online {
        tls {
                dns cloudflare {env.CLOUDFLARE_API_TOKEN} #  for Cloudflare
                resolvers 1.1.1.1
                protocols tls1.3
        }


        # Proxy /portainer/* to Portainer on HTTPS
        @portainerNoSlash {
                path /portainer
        }
        redir @portainerNoSlash /portainer/ permanent

        handle_path /portainer/* {
                reverse_proxy portainer:9000
        }
}

and redoing portainer with compose:

version: "3.8"

services:
  portainer:
    image: portainer/portainer-ce:linux-arm64
    container_name: portainer
    restart: always
    networks:
      - moony_caddynet
    expose:
      - "9000"
      - "9443"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - portainer_data:/data

volumes:
  portainer_data:

networks:
  moony_caddynet:
    external: true

i get timeout.html err 307

All right, made it work, but with http on the backend, as i get forbidden - csrf token invalid when adding my pem files to ssl (altho i might have generated onl tls files and i’m just dumb)

compose.yaml

version: "3.8"

services:
  portainer:
    image: portainer/portainer-ce:linux-arm64
    restart: always
    networks:
      - moony_caddynet
    expose:
      - "9000"
      - "9443"
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
      - portainer_data:/data
    environment:
      - PORTAINER_FEATURE_FLAGS=proxy_headers

  caddy:
    image: ghcr.io/serfriz/caddy-cloudflare:latest
    command: caddy run --config /etc/caddy/Caddyfile --adapter caddyfile
    environment:
      - CLOUDFLARE_API_TOKEN=[token]
    ports:
      - "80:80"
      - "443:443"
    volumes:
      - /home/moony/caddy/config:/config
      - /home/moony/caddy/data:/data
      - /home/moony/caddy/Caddyfile:/etc/caddy/Caddyfile
      - /home/moony/caddy/logs:/var/log/caddy
    networks:
      - moony_caddynet

volumes:
  portainer_data:

networks:
  moony_caddynet:
    external: true

Caddyfile

#Global Config
{
#        debug
        email [CF_email]
        servers {
                trusted_proxies cloudflare {
                        interval 12h
                        timeout 15s
                }
        client_ip_headers Cf-Connecting-Ip X-Forwarded-For
        }
#        log default {
#                level DEBUG
#                output file /var/log/caddy/caddy.log
#        }
}

# Serve everything through hls.mooncore.online on HTTPS
hls.mooncore.online {
        tls {
                dns cloudflare {env.CLOUDFLARE_API_TOKEN} #  for Cloudflare
                resolvers 1.1.1.1
                protocols tls1.3
        }


        # Proxy /portainer/* to Portainer on HTTPS
        @portainerNoSlash {
                path /portainer
        }
        redir @portainerNoSlash /portainer/ permanent

        handle_path /portainer/* {
                reverse_proxy portainer:9000
        }
}
2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.