New Caddy add-on

strangely, so far evertything works without http: entirely !

Does cast work? I also way back could not create a token without a base_url

Just checked, it works

This works too

Thanks so much for sharing the syntax you use for sub-subdomains!!!

It finally worked for me :blush: :smiley:

Ive been tearing my hair out for days now with no luck getting this to work. I use my own domain through loopia and pointed A to my public ip adress. If I open 8123 -> 8123 i can access HA from autiside using my-own.domain.se:8123. So there shouldnt be a problem with the pointing.

My caddyfile looks like this:

my-own.domain.se {
    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"
}
    proxy / 192.168.1.70:8123 {
        websocket
        transparent
    }
}

The caddy addon seems to work and running with the logs saying this:

Using built-in Caddy: Caddy 0.11.1 (unofficial)
Running Caddy:  /usr/sbin/caddy -conf /share/caddy/Caddyfile -agree -email [email protected]
Activating privacy features... done.
https://my-own.domain.se
http://my-own.domain.se

My portforwardning is: 192.168.1.70 is my HA adress.
80 -> 80 for 192.168.1.70
433 -> 433 for 192.168.1.70

http:
  base_url: https://my-own.domain.se
  ip_ban_enabled: False
  login_attempts_threshold: 3
  use_x_forwarded_for: true
  trusted_proxies: 127.0.0.1

When I try to access it i get 401 Authorization Required, nginx

Can anyone point me in the right direction to get this to work?

/r1kkie

You’re saying that it says “nginx” somewhere on the 401 page?

Yes, looks like this but remove the 0.7.67 (took a picture from google)

My working caddy-file looks like this:

my-ip-address.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"
}
    proxy / 127.0.0.1:8123 {
        websocket
        transparent
    }
}

@r1kkie Then something else is going on. Caddy wouldn’t say “nginx” on it’s error page, so you’re not getting to Caddy through that path. Are you running Nginx somewhere? Are you sure your router isn’t intercepting 80 and 443 for itself? Are you sure your ISP doesn’t block 80 and 443?

@r1kkie please notice this line:

proxy / 127.0.0.1:8123 {

hello
i have installed Caddy add-on on my hass.io
But why have errors and can’t work ??
LOG:
Using built-in Caddy: Caddy 0.11.1 (unofficial)
**Running Caddy: /usr/sbin/caddy -conf /share/caddy/Caddyfile **
Activating privacy features… done.
https://xxxxx.duckdns.org:8888
WARNING: File descriptor limit 1024 is too low for production servers. At least 8192 is recommended. Fix with ulimit -n 8192.

Better go the new route: Home Assistant Add-on: Caddy 2
If your config is simple, no need to create the /share/caddy/Caddyfile :slight_smile:

Thank you.I just use caddy 2 add-on in my HA,and it work nice.
But I don’t know how to use two websites to proxy.I use HA of configuration.
If I want to have two websites,i must use Caddyfile,right???

Hi @smallfus,
Correct, with two websites, you will need a Caddyfile. Luckily, creating one is very simple.
Just place the following content into a file called Caddyfile and store it under share/caddy/. Don’t forget to exchange your data accordingly.

{
	email [email protected]
}

yourdomain1.com {
	reverse_proxy localhost:8123
}

yourdomain2.com {
	reverse_proxy localhost:8123
}

Note: The above example is a Caddy 2 caddyfile!

The file could be simplified even further, but one after the other. For further help regarding Caddy 2, please don’t hesitate to raise them in the according topic here

OK,thank you.
Another question,
yourdomain1.com {
Above syntax,can I set port for listening
Like that
yourdomain1.com:8888 {

Yes, that is possible:

OK.thanks too much.

This server can install on Ubuntu??
My HA work on DOCKER,can I use caddy2 to make HA https??

Hello, everyone. Due to a lack of time I’ve decided to archive this add-on. I suggest migrating to the Caddy 2 add-on… You can read more in the README.

Thank you to everyone who has helped me support this add-on over the past few years.

2 Likes