Creating an LB for MinIO

I’m trying to create an LB for MinIO in Docker and for don’t know which reasons my curl against Docker service name is not working. I’m expecting to be something related with my Caddy config as I’m having other services configured with Caddy more or less in same manner and it is working.

My config is

:3000 {
	reverse_proxy * {
		to https://public_ip1:9000
		to https://public_ip2:9000
		to https://public_ip3:9000
		to https://public_ip4:9000

		transport http {
			tls_insecure_skip_verify
		}

		lb_policy       random_choose 2
		health_uri     	/minio/health/live
		health_interval	30s
		health_timeout 	10s
		health_status	200
	}
}

Now … this is a Docker service. What I tried and it is working and what is not working.
If I’ll exec into Docker container and I’ll run curl http://localhost:3000 it will give me the expected output

<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>AccessDenied</Code><Message>Access Denied.</Message><Resource>/</Resource><RequestId>1702037E7DFC68D0</RequestId><HostId>3a8aca59-5d50-48e4-b1db-506c05a1ebf6</HostId></Error>/app

But if I’ll try to curl against service name [lets say I created as docker service create --name minio_lb ...] … curl http://minio_lb:3000 will response with:

<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>InvalidRequest</Code><Message>Invalid Request (invalid hostname)</Message><Resource>/</Resource><RequestId></RequestId><HostId>3a8aca59-5d50-48e4-b1db-506c05a1ebf6</HostId></Error>/app

Any ideas please?

:man_shrugging:

This isn’t really a question about Caddy, it’s a question about how MinIO works. I can’t answer that. MinIO is producing that error, so you’ll need to ask them what could be the issue.

But in general, when proxying over HTTPS, you typically need the Host header to be correct. It should match the domain/certificate that the upstream is expecting. See the docs:

4 Likes

Thanks @francislavoie the issue was actually my missing header

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.