nginx – How to use Ngnix as a reverse proxy to access OpenShift (OKD) 4.X?

How to use Ngnix as a reverse proxy to access OpenShift (OKD) 4.X?

I’ve tried hundreds of setups for the reverse proxy (Nginx) and they all fail with the error “Application is not available” when we access the route.

NOTE: This problem does not occur if we access this route directly (without using Reverse Proxy). Perhaps some information necessary for the route to be resolved is not being sent.

This is the basic configuration template we are using…

server {
    access_log /var/log/nginx/;
    error_log /var/log/nginx/;
    server_name ~^(?<subdomain>.+)$;

    location / {
        proxy_set_header Host $;
        proxy_set_header X-Forwarded-For https://$$request_uri;

    listen 443;
    ssl_certificate /etc/letsencrypt/live/;
    ssl_certificate_key /etc/letsencrypt/live/;
    include /etc/letsencrypt/options-ssl-nginx.conf;
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;

We also tested these parameters and got some problems as you can see below…

server {
    location / {
        proxy_ssl_certificate /etc/nginx/backend_ss_certs/;
        proxy_ssl_certificate_key /etc/nginx/backend_ss_certs/;
        proxy_ssl_trusted_certificate /etc/nginx/backend_ss_certs/;
        proxy_ssl_ciphers HIGH:!aNULL:!MD5;
        proxy_ssl_protocols TLSv1.2 TLSv1.3;
        proxy_ssl_server_name on;
        proxy_ssl_session_reuse on;
        proxy_ssl_verify on;

The certificates,, are the self-signed certificates used by OpenShift (OKD) to allow access to resources (HTTPS). However if we try to use these certificates with the reverse proxy (Nginx) the following error happens (“Bad Gateway”)…

2021/07/22 17:36:11 (error) 6999#6999: *1 upstream SSL certificate verify error: (21:unable to verify the first certificate) while SSL handshaking to upstream, client:, server: ~^(?<subdomain>.+)$, request: "GET /favicon.ico HTTP/1.1", upstream: "", host: "", referrer: ""

NOTA: We tested the and certificates using curl and both worked perfectly.

PLUS: We couldn’t define a way to diagnose/observe (logs) about what goes wrong when the request arrives the route . I think this would help us figure out what’s going wrong.