docker-archive / dockercloud-haproxy

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

Is there a way to specify HTTP_BASIC_AUTH for specific backends only? #163

Closed virtuman closed 7 years ago

virtuman commented 7 years ago

Is there a way to specify HTTP_BASIC_AUTH during startup of a specific container only? Ie. i want all production sites to be running without HTTP_AUTH, but all dev sites to be automatically protected by HTTP_AUTH, and HTTP AUTH should trigger only if the request is not from white-listed IP address ? That's how we currently have it set up with our own Haproxy, but would like to switch to the use of the dynamic haproxy configuration based on this project.

Thank you.

tifayuki commented 7 years ago

@virtuman

First of all, I don't think it is a good practice to make the dev and prod use the same proxy. It is better to use a different proxy for each environment.

And if you do need that setting, you can set HTTP_BASIC_AUTH in the haproxy container, and EXCLUDE_BASIC_AUTH=true in your prod app.

It is not available in the lasted version of dockercloud/haproxyyet, but the changes are already in the staging branch. We will release this soon.