0

I am getting this message in nginx (1.18) error.log file

*39 SSL_do_handshake() failed (SSL: error:1408F10B:SSL routines:ssl3_get_record:wrong version number) while SSL handshaking to upstream

I saw a lot of answers here, but none of them solve my problem.

I am trying to implement an api gateway. It should be the simplest thing in the world...

api_gateway.conf

include api_keys.conf;

server {
    access_log /var/log/nginx/api_access.log; # Each API may also log to a 
                                                   # separate file
    auth_request /_validate_apikey;
    
    root /var/www/api;
    index index.html index.htm index.nginx-debian.html;
    listen 443 ssl;
    server_name api.example.com.br;
    
    location /microservices/ {
        proxy_pass https://127.0.0.1:10001/;
    }
   
    location /ms-email-sender/ {
        proxy_pass https://127.0.0.1:10002/;
    }

    # Error responses
    error_page 404 = @400;         # Treat invalid paths as bad requests
    proxy_intercept_errors on;     # Do not send backend errors to client
    include api_json_errors.conf;  # API client-friendly JSON errors
    default_type application/json; # If no content-type, assume JSON

    # API key validation
    location = /_validate_apikey {
        internal;

        if ($http_apikey = "") {
            return 401; # Unauthorized
        }
        if ($api_client_name = "") {
            return 403; # Forbidden
        }

        return 204; # OK (no content)
    }

    ssl_certificate /etc/letsencrypt/live/api.optimusdata.com.br/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/api.optimusdata.com.br/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}


server {
    if ($host = api.optimusdata.com.br) {
        return 301 https://$host$request_uri;
    } # managed by Certbot


    server_name api.optimusdata.com.br;
    listen 80;
    return 404; # managed by Certbot
}

My services are written in node.js

I tried to put some directives under location block like proxy_ssl_verify off;

I changed a lot of things the api_gateway.conf

I saw several tutorials in the web and all of them are quite look alike that one.

0 Answers0