I want to send the DN field from the client certificate ($ssl_client_s_dn), but I want to send it encrypted.
In the question nginx append query parameter to a react application it is explained how to add a parameter to a react application using rewrite and try_files, and how to prevent the infinite rewrite redirecting loop.
But I don't know how to encrypt this variable ($ssl_client_s_dn).
My configuration file is
server {
listen 9999 ssl default_server;
listen [::]:9999 ssl default_server;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_certificate /keystores/mycert.crt.pem; ##
ssl_certificate_key /keystores/mycert.key.pem; ##
ssl_client_certificate /keystores/.npm.certs.pem; ## CA Bundle
ssl_verify_client on;
root /home/edu/my-react-app;
index index.html;
server_name _;
location / {
try_files $uri $uri/ /index.html =404;
}
location = /login {
if ($arg_DN = "") {
rewrite ^ /login?DN=$ssl_client_s_dn redirect;
}
try_files /index.html =404;
}
}
Any help? Thanks