Problem with Caddy config - vhosts array

Here is my current config that used to work:

{
  "homeassistant": "mydomain.duckdns.org",
  "vhosts": [
    {
      "vhost": "mydomain1.duckdns.org",
      "port": "1880"
    },
    {
      "vhost": "mydomain2.duckdns.org",
      "port": "5051"
    },
    {
      "vhost": "mydomain3.duckdns.org",
      "port": "3218"
    },
    {
      "vhost": "mydomain4.duckdns.org",
      "port": "3000"
    }
  ],
  "raw_config": [],
  "email": "[email protected]"
}

Now the addon will not start (not sure if it was due to an update to either hassio or caddy) unless I remove all of the vhost entries. Doing so, I can access the HA frontend outside my local network but I would really like to at least access node red as well from outside.

Any time I try to add any of the vhost entries, the addon gives me this error and will not let me start the addon:
not a valid value for dictionary value @ data['options']
I think there must have been an update that altered the format for the vhost entries but I cannot figure it out. I have also tried cutting/pasting other examples I have found in the forums here and they produce the same error. This is the only config that will let me start the addon so far:

{
  "homeassistant": "mydomain.duckdns.org",
  "vhosts": [],
  "raw_config": [],
  "email": "[email protected]"
}

Anyone else experiencing this?

You posted this in hass.io - are you using the Korylprince Caddy addon?
My caddy file looks NOTHING like what you posted. Or is that the addon config?

My caddy file starts like this:

my-domain.duckdns.org {
    header / {
    Strict-Transport-Security "max-age=31536000; includeSubdomains"
    X-XSS-Protection "1; mode=block"
    X-Content-Type-Options "nosniff"
    X-Frame-Options "SAMEORIGIN"
    Referrer-Policy "same-origin"
    -Server
}
    proxy / localhost:8123 {
        websocket
        transparent
    }
}

terminal.my-domain.duckdns.org {
    proxy / localhost:7681 {
        websocket
        transparent
    }
}

my addon config is:

{
  "flags": [
    "-agree",
    "-email",
    "email-address"
  ]
}

I am using the Caddy Proxy Addon by bestlibre.
so, my issue is just with the config file that you populate within the Hassio addon settings.

Thanks, I just switched over to the korylprince version and everything seems to be working!

Edit: I used your tutorial as well!

1 Like

Good to hear Geoff. Weird that the original addon you were using stopped working though. Glad you found my tutorial useful.

Hi there,

I am also using the bestlibre caddy addon (https://github.com/bestlibre/hassio-addons/tree/master/caddy_proxy), however I’ve just updated the addon and there appears to be a breaking change. Can anyone please provide an example of what a properly-formatted vhosts entry would look like? I’ve read the docs but I’m not making any progress… many thanks

Ok so I finally figured it out. When moving to the latest version of the bestlibre caddy addon you need to add “paths”: [] to each vhost or the config is invalid.

So an example entry now looks like this:

{
  "vhost": "sabnzbd.mydomain.com",
  "remote": "192.168.1.8",
  "port": "8080",
  "paths": []
},
2 Likes

Was just about to mention this. I don’t have mine set up currently, but a friend ran into the same issue and adding paths: [] was what I suggested. He ended up just deleting the vhost, so I never got confirmation if it would actually fix it. Good to know it does.