I did not definitively find the issue, but I was suspecting it was to do with the http header casing, which I can see causes some issues with certain proxy targets, e.g. Different capitalization on Response Headers - but that is just a wild guess, might be something totally different.
I saw that the websocket was connecting, but it was then being disconnected soon afterwards. The response headers were also missing the Sec-Websocket-Accept header… which is present when it is working correctly, so perhaps caddy is not handling that somehow?
As it worked with nginx-proxy-manager, I had wanted to inspect the headers, but that seemed too much effort.
I setup traefik to see how that would work, and it proxied to the cerbo fine, I can use the virtual console, etc…
So, sadly, I will switch to traefik. I did really enjoy the simplicity of the Caddyfile configuration, and I find traefik a bit more fiddly, verbose, and feels more complicated, but it works for this scenario, so it is the winner.
As alternative you can create a TLS SNI route in the Layer 4 module included in Caddy on the OPNsense. If that victron thing has a self signed certificate installed, that will work just nicely.
Can you share the url for your cerbo gx? If you don’t mind, you can host your app using nginx-proxy-manager, while I create a caddy instance to reverse proxy to your site to help debug this issue?
Notice the websocket header name is the correct case. And fortunately, this function is also used when stdlib send a request, so it will work if I added this to caddy.
@solear
Can you try using the included Layer4 module as an alternative?
Go to “General Settings - Advanced Settings” and check “Enable Layer4”. Apply and go to “Reverse Proxy - Layer4 Routes”
Add a new route with
Matchers: TLS (SNI Client Hello)
Domain: e.g., venus.example.com
Upstream Domain: Internal IP of your solar thingy
Upstream Port: Port of your solar thingy
Remote IP: The internal IPs you want allow access (e.g., 192.168.0.0/16)
Apply and then open https://venus.example.com and it will be reverse proxied without TLS termination, meaning you should see the self signed certificate (if it has one).
Hello Monviech,
No luck with layer 4. There is the same error (“Failed to connect. Make sure to enable Remote Console for LAN, and reboot the device.”).
@solear I’ve build a caddy version with the cherry picked commit from above.
Connect to your OPNsense via SSH with the root user
Go to the Shell (Option 8)
Enter the following commands in order, each line is one command to copy and paste. Do not copy paste all of them at once, one line each and press enter:
Just be cautious with OPNsense updates, it might take a while to downstream this fix into the main repos. [probably after caddy 2.9.x released] If in doubt repeat these steps from above after an update, I will host this for a while.
Ah nice, thanks for the work. I somehow imagined this thread would die, and no fix emerge, so happy to see that
Maybe I’ll switch back from traefik… although I found another benefit of traffic, the tcp proxying is built in, which I need for another endpoint that uses client certificates. It also let’s me handle caddy-terminated tls and tcp proxy with tls passthrough on the same port, not sure if the layer4 caddy module supports that?