Skip to content

Instantly share code, notes, and snippets.

@zen-k
Forked from fredead/haproxy.conf
Created June 28, 2017 10:51
Show Gist options
  • Save zen-k/5827ec974dc70bd4a45993528c521efd to your computer and use it in GitHub Desktop.
Save zen-k/5827ec974dc70bd4a45993528c521efd 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment