1

i setup nginx for proxypass to docker registry, the protocol http works but if i set https i have: 400 The plain HTTP request was sent to HTTPS port

This is my nginx configuration file:

upstream docker-registry {
 server 127.0.0.1:5000;
}

server {
 listen 443 ssl;
 server_name docker-registry.mydomain.it;

  ssl_certificate /etc/ssl/certs/docker-registry;
  ssl_certificate_key /etc/ssl/private/docker-registry;

 proxy_set_header Host       $http_host;   # required for Docker client sake
 proxy_set_header X-Real-IP  $remote_addr; # pass on real client IP

 client_max_body_size 0; # disable any limits to avoid HTTP 413 for large image uploads

 # required to avoid HTTP 411: see Issue #1486 (https://github.com/dotcloud/docker/issues/1486)
 chunked_transfer_encoding on;

 location / {
     # let Nginx know about our auth file
     auth_basic              "Restricted";
     auth_basic_user_file    docker-registry.htpasswd;
     proxy_pass http://docker-registry;
 }
 location /_ping {
     auth_basic off;
     proxy_pass http://docker-registry;
 }
 location /v1/_ping {
     auth_basic off;
     proxy_pass http://docker-registry;
 }

}
4

Add:

proxy_set_header X-Forwarded-Proto $scheme;
  • 4
    Welcome to Unix & Linux! While this code snippet may solve the question, including an explanation really helps to improve the quality of your post. Remember that you are answering the question for readers in the future, not just the person asking now! Please edit your answer to add explanation, and give an indication of what limitations and assumptions apply. – Toby Speight Dec 15 '16 at 11:40
  • This solution helped me. I had already added proxy_set_header X-Forwarded-Scheme $scheme;, but it seems X-Forwarded-Proto is required for docker-registry. – kaorukobo Apr 6 '17 at 12:26
0

Th problem was the docker-registry configuration, i have resolved adding the line -H tcp://127.0.0.1:2375 -H unix:///var/run/docker.sock --insecure-registry localhost:5000 to /etc/sysconfig/docker under OPTIONS

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.