Skip to content

Instantly share code, notes, and snippets.

@fredead
Last active June 28, 2017 10:51
Show Gist options
  • Save fredead/b8a834be4e6395015380 to your computer and use it in GitHub Desktop.
Save fredead/b8a834be4e6395015380 to your computer and use it in GitHub Desktop.
haproxy for docker registry
frontend https
bind :80
bind 0.0.0.0:443 ssl crt /etc/haproxy/mydomain.com.pem
reqadd X-Forwarded-Proto:\ https
redirect scheme https if !{ ssl_fc }
acl docker_registry_domain hdr(host) -i docker-register.mydomain.com
# This is a hack for docker not always sending basic auth data
acl docker_token hdr(Authorization:) -i Token
acl auth_docker_registry http_auth(auth_list)
acl docker_registry_ping url_sub _ping
http-request auth realm Restricted if !auth_docker_registry docker_registry_domain !docker_registry_ping !docker_token
use_backend docker-register if docker_registry_domain
userlist auth_list
user usera password $6$mQwPjhougLpSk7$4ydwedihqwidehwdhwidipewjdipjewidweiph
backend docker-register
server localdockerreg 127.0.0.1:5000
@fredead
Copy link
Author

fredead commented Dec 8, 2016

This should not be required these days.

@leandropissurno
Copy link

Why not?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment