News for hackers. Stuff that matters.
Re:Caddy is the first and only web server to use HTTPS autom... by teekert on Tuesday September 12, 2023 @06:05AM (#37478879)
I love caddy, I used to litter my docker-compose.yaml files with Traefik labels like:

    labels:
      - traefik.enable=true
      - traefik.http.routers.foundryvtt-http.entrypoints=web
      - traefik.http.routers.foundryvtt-http.rule=Host(`vtt.xxx.nl`)
      - traefik.http.routers.foundryvtt-http.middlewares=foundryvtt-https
      - traefik.http.middlewares.foundryvtt-https.redirectscheme.scheme=https
      - traefik.http.routers.foundryvtt.middlewares=foundryvtt-auth
      - traefik.http.middlewares.foundryvtt-auth.basicauth.users=${foundryvtt-BASIC_AUTH}
      - traefik.http.routers.foundryvtt.entrypoints=websecure
      - traefik.http.routers.foundryvtt.rule=Host(`vtt.xxx.nl`)
      - traefik.http.routers.foundryvtt.tls=true
      - traefik.http.routers.foundryvtt.tls.certresolver=mytlschallenge
      - traefik.http.services.foundryvtt.loadbalancer.server.port=30000
Now I just add the containers (by name), no labels, and map Caddy to their port, like so (in the Caddyfile):

    data.xxx.com {
         reverse_proxy projectsend:80
    }
or, this snippet refers to a WordPress container with BasicAuth in front of it:

    restricted.xxxx.com {
            root * /var/www/html/restricted.xxxx.com/wordpress
            php_fastcgi wordpress-xxxx-restricted:9000 {
             root /var/www/html
                    }
            basicauth /* {
             xxx $xx$x05xxxxxxxxx.xx
            }
            file_server
    }
I love the simplicity.
Re:Caddy is the first and only web server to use HTTPS autom... by ilyt on Tuesday September 12, 2023 @06:36AM (#37479044)
That says more about shitty trend of using labels as a config than anything else.

12 factor app did untold damage to the industry convincing smart-but-inexperienced developers that key-value-only systems are somehow good way to configure anything more complex than "this app needs server, password and user"

Re:Caddy is the first and only web server to use HTTPS autom... by teekert on Tuesday September 12, 2023 @06:40AM (#37479080)
Well, apart from the labels, I'm also happy I got rid of that middleware stuff that I still don't fully understand.
Re:Caddy is the first and only web server to use HTTPS autom... by jbverschoor on Tuesday September 12, 2023 @07:56AM (#37479702)
Remind me of essentially moving Java code to XML with Spring. Typical platform-in-a-platform syndrome.
Re:Caddy is the first and only web server to use HTTPS autom... by theshrike79 on Tuesday September 12, 2023 @07:55AM (#37479696)
Wait? Caddy can do all that?

I really need to grab a few beers and check out the documentation, my current docker setup is a cargo-cult traefik label monster I just copied from a friend =)

It works, but I really don't know why or how

Re:Caddy is the first and only web server to use HTTPS autom... by Whitestrake on Tuesday September 12, 2023 @08:46PM (#37490733)
Heck, you could extend it with Caddy Docker Proxy and go right back to the labels-as-configuration method.

https://github.com/lucaslorentz/caddy-docker-proxy

I actually do this, because I kinda like having the proxy config right next to the app config in my Compose file, but I also dislike how much manual configuration Traefik needs. Downside is you need to know how to write Caddyfile (easy enough) and then also know how to write labels so CDP translates them into the correct Caddyfile (also easy enough, but could be annoying if you're learning both at the same time). Upshot is that once you know how it translates and you know what you need to write, it works just like Traefik but with just two labels, and I think that's pretty neat.

Caddy can support a surprising amount of weird and wonderful configurations, too.

Re:Caddy is the first and only web server to use HTTPS autom... by jhot on Tuesday September 12, 2023 @10:57PM (#37491681)
I do this at home. The labels are generally much simpler than traefik.

labels:

  caddy: subdomain.${DOMAIN_NAME}

  caddy.reverse_proxy: "{{upstreams 8000}}"