docker-archive / dockercloud-haproxy

HAproxy image that autoreconfigures itself when used in Docker Cloud
https://cloud.docker.com/
651 stars 187 forks source link

Basic auth on a single service? #229

Open wizonesolutions opened 6 years ago

wizonesolutions commented 6 years ago

The HTTP_BASIC_AUTH variable only applies at the global level. Is it possible to require authentication for just a specific service without setting it globally and excluding every other service?

roks0n commented 6 years ago

I haven't tested but looking at their docs it says:

Global and default settings of HAProxy HTTP_BASIC_AUTH -> a comma-separated list of credentials(:) for HTTP basic auth, which applies to all the backend routes. To escape comma, use \,. Attention: DO NOT rely on this for authentication in production

Settings in linked application services EXCLUDE_BASIC_AUTH -> if set(any value) and HTTP_BASIC_AUTH global setting is set, no basic auth will be applied to this service.

Given that information I assume you apply HTTP_BASIC_AUTH on all services, but you explicitly remove authentication using EXCLUDE_BASIC_AUTH on each of your service.

jontro commented 6 years ago

The way @roks0n suggests works perfectly fine, I am using it this way currently. I think this issue can be closed