SBaronda.com a little place I like to call home.


Setting up MinIO behind Caddy V1 (with MinIO Console)

Nov. 3, 2023

For my hosting environment, I'm still running Caddy V1 :( for some applications. In one application, I needed to reverse proxy to MinIO.

The way that I wanted it setup was to allow o.tld to be the object storage (aka MinIO Server) and o.tld/console to be the console application to manage it. This would allow me to stick with one domain for handling all MinIO related things.

This is the architecture that of above:

CaddyMinIO ConsoleMinIO Servero.tld/console/o.tld/


Not many tutorials exist for Caddy V1 and I needed to reverse engineer the Nginx docs for MinIO to get this working with Caddy V1.

This is the steps that I used.

  1. Get MinIO working
docker run -d -p 9000:9000 -p 9001:9001 \
        -v minio_data:/data \
        --env MINIO_ROOT_USER="minio_root" --env MINIO_ROOT_PASSWORD='my_password!!' \
        --env MINIO_BROWSER_REDIRECT_URL="https://o.domain.com/console" \
        quay.io/minio/minio server /data --console-address ":9001"
  1. Test MinIO with mc
./mc alias set o http://IP:9000 minio_root 'my_password!!'
./mc mb o/test
./mc ls o

You should have created a bucket (mb) and you should be able to list (ls) the bucket you just created.

  1. Proxy behind MinIO
o.tld {
        tls [email protected]
        log /srv/o.tld/log/log {
                        rotate_size 50  # Rotate after 50 MB
                        rotate_age  90  # Keep rotated files for 90 days
                        rotate_keep 20  # Keep at most 20 log files
                        rotate_compress # Compress rotated log files in gzip format
        }

        proxy / http://172.17.0.1:9000 {
                transparent
        }
        redir /console /console/
        proxy /console http://172.17.0.1:9001 {
                transparent
                without /console
        }

}

The key to making this work is the redir, which adds in the trailing slash. This was needed since going to https://o.tld/console wouldn't load the application, but https://o.tld/console/ did.

The smoke test

  • Try accessing http://o.tld, it should redirect to https and eventually redirect to /console and eventually to /console (see below)
  • Try accessing http://o.tld/console it should redirect to https and add the trailing forward slash for you
  1. Update mc alias and test again
./mc alias set o https://o.tld minio_root 'my_password!!'
./mc mb o/test2
./mc ls o

Well that is it. Hopefully this saves you some time if you are still using Caddy V1 like me. If you have any questions don't hesitate to write a comment below.


comments powered by Disqus