title: Client Certificate Authentication Nginx SSL Pass Through
body: <p>I've set up an NGINX as proxy before a docker registry. The registry uses tls to authenticate users (and is configured properly; I can pull images inside the cluster with the certificate). The nginx is configured like this:</p>
  
  <pre><code> server {
        listen 443;
        server_name default_server;
  
        #charset koi8-r;
        #access_log  /var/log/nginx/host.access.log  main;
  
        location / {
          if ($remote_addr != xxx) {
            return 403;
            break;
          }
          proxy_set_header Host $host; 
          proxy_pass https://xxx:xxx;
          break;
        }
  
        error_page  404              /404.html;  
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
          root   /usr/share/nginx/html;
        }
      }
  </code></pre>
  
  <p>Now, when I try curling with a valid certificate like this:</p>
  
  <pre><code>curl -v --key client.key --cert client.cert  xxx:xxx/v2/_catalog
  </code></pre>
  
  <p>I get an <code>http: TLS handshake error from xxx:xxx: tls: client didn't provide a certificate</code> error in the docker registry logs. Is the nginx configured properly or is there sth missing? Any ideas on how to debug this further?</p>
  
  <p>The NGINX logs state:</p>
  
  <pre><code>[error] 8#8: *65 SSL_do_handshake() failed (SSL: error:14094412:SSL routines:ssl3_read_bytes:sslv3 alert bad certificate:SSL alert number 42) while SSL handshaking to upstream,
  </code></pre>