How can set the request of expressjs to properly identify a TLS connection with https nginx server so that I can perform authentication through getPeerCertificate
?
this is my nginx config to transfer request to expressjs api
location /api {
proxy_pass http://10.88.132.14:4337/api;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
You need to pass the SSL-token and then manually decode it. You pass it through adding
X-SSL-CERT
with the$ssl_client_escaped_cert
. Make sure you are using Nginx 1.13 or later as the$ssl_client_escaped_cert
didn't exist in 1.12.Now you can't use
getPeerCertifice()
as this requires the full SSL-connection. Instead you decode thex-ssl-cert
header from above using thex509
package: