Caddy Reverse proxy websocket error on UNRAID

Hi everybody,

I switched from Freenas to UNRAID. I set up Caddy in a container. I also set up a reverse proxy, however I am unable to get HomeAssistant running on it. The page loads up fine, however when I enter the password, the loading circle just spins forever.

I get the following error in console: WebSocket connection to ‘wss://’ failed: Error during WebSocket handshake: Unexpected response code: 502

This is how my Caddyfile looks like for this instance: {
proxy / {

I have also tried many variations to no avail. I’m happy to provide my site information and password (over PM).

This worked perfectly on FreeNAS, so I’m not sure where the culprit is.

If anybody can point me to the right direction, I would really appreciate it!

Can you post the output of:

curl -i -N -v -H “Connection: Upgrade” -H “Upgrade: websocket” -H “Host:” -H “Origin: https://mysite.com

Or if you dont have curl the headers from both the UNRAID side and the caddy side of the situation?

@SpiraMirabilis, thank you for your reply!

Unfortunately, it doesn’t output anything:

Thats because you didnt close a quotation mark somewhere. Maybe that last -H with the Origin? Make sure they’re " quotes or single quotes ’ and not the unicode open and end quotes (“”) that I just had to edit out of this post.

Writing it like this in a text editor can help debug long commands:

curl -i -N -v \
-H ‘Connection: Upgrade’ \
-H ‘Upgrade: websocket’ \
-H ‘Host:’ \
-H ‘Origin:’ \

Tried the single quotations with no luck as well:


I do this on my UNRAID IP, right? I have UNRAID running on, however CADDY is running on its own IP at

Both, preferably. So caddy operates on .19 as a reverse proxy to a websocket resource on .3? You can access both things simultaneously? If so, you might be able to just use to search for and replace the URL that caddy is not proxying properly with the .19 address equivalent and skip the middleman as it were.

This would only work while you’re inside your network of course, if you were planning on accessing this from the internet via caddy as a traditional reverse-proxy well we’d have to find out whats wrong.

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