plugins: www/caddy: v2.9.0 breaks proxying OPNSense Web GUI

Important notices Before you add a new report, we ask you kindly to acknowledge the following:

Describe the bug The update to caddy-v2.9.0 breaks proxying the OPNSense WebGUI - there are intermittent cases where Caddy returns a http 400. This has been reported by several others here https://caddy.community/t/access-to-opnsense-throws-a-400-bad-request-after-upgrading-caddy-from-2-8-4-to-2-9/29525

To Reproduce Steps to reproduce the behaviour:

Add a handler pointing to OPNsense:

  • https
  • skip TLS verify.

Expected behavior A clear and concise description of what you expected to happen.

Screenshots Image

Relevant log files

2025-01-15T23:18:14	Error	caddy	"warn","ts":"2025-01-15T23:18:14Z","logger":"http.handlers.reverse_proxy","msg":"aborting with incomplete response","upstream":"hell01-router01.dcrdev.com:8443","duration":0.02584911,"request":{"remote_ip":"10.210.1.231","remote_port":"60519","client_ip":"10.210.1.231","proto":"HTTP/2.0","method":"GET","host":"hell01-router01.dcrdev.com","uri":"/apple-touch-icon-precomposed.png","headers":{"Cookie":["REDACTED"],"Accept":["*/*"],"X-Forwarded-For":["10.210.1.231"],"X-Forwarded-Proto":["https"],"X-Forwarded-Host":["hell01-router01.dcrdev.com"],"User-Agent":["com.apple.WebKit.Networking/20620.1.16.11.8 CFNetwork/1568.300.101 Darwin/24.2.0"],"Accept-Language":["en-GB,en;q=0.9"],"Accept-Encoding":["gzip, deflate, br"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"hell01-router01.dcrdev.com"}},"error":"writing: http2: stream closed"}	
2025-01-15T23:09:28	Error	caddy	"warn","ts":"2025-01-15T23:09:28Z","logger":"http.handlers.reverse_proxy","msg":"aborting with incomplete response","upstream":"hell01-router01.dcrdev.com:8443","duration":0.130546344,"request":{"remote_ip":"10.210.1.231","remote_port":"60333","client_ip":"10.210.1.231","proto":"HTTP/2.0","method":"GET","host":"hell01-router01.dcrdev.com","uri":"/api/diagnostics/cpu_usage/stream","headers":{"X-Forwarded-Proto":["https"],"X-Forwarded-Host":["hell01-router01.dcrdev.com"],"Accept":["text/event-stream"],"Sec-Fetch-Site":["same-origin"],"Pragma":["no-cache"],"Sec-Fetch-Mode":["cors"],"Cache-Control":["no-cache"],"User-Agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.2 Safari/605.1.15"],"Sec-Fetch-Dest":["empty"],"Accept-Language":["en-GB,en;q=0.9"],"X-Forwarded-For":["10.210.1.231"],"Cookie":["REDACTED"],"Accept-Encoding":["gzip, deflate, br"],"Referer":["https://hell01-router01.dcrdev.com/ui/core/dashboard"]},"tls":{"resumed":false,"version":772,"cipher_suite":4865,"proto":"h2","server_name":"hell01-router01.dcrdev.com"}},"error":"reading: context canceled"}

Additional context

  1. Clearing browser cache restores service temporarily (<1 min)
  2. This issue seems to specific to proxying the OPNSense web gui, other services being proxied seem unaffected.
  3. Downgrading the plugin fixes the issue

Environment OPNsense 24.7.12-amd64 FreeBSD 14.1-RELEASE-p6 Browsers: Safari / Chrome

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 20 (13 by maintainers)

Most upvoted comments

For anyone using Caddy directly (not the opnsense plugin) there are two fixes I’ve found that work:

  1. Remove the Alt-Svc response header: header -Alt-Svc (place in your site block)

or

  1. Set the supported http version in your reverse_proxy -> transport http block to 1.1:
    transport http {
    	tls_insecure_skip_verify
    	versions 1.1
    }
    

@gstrauss Thank you for the explanation. I was hesitent because Im not an expert regarding the lighttpd webserver. When I see an option thats not enabled by default, I imply that it has a reason (e.g. its a secure default).

EDIT: I’ll offer a PR in opnsense/core to enable this setting and see how the discussion goes. Maybe.