Welcome! Log In Create A New Profile

Advanced

nginx - peer closed connection in SSL handshake while SSL handshaking to upstream

I am trying to use nginx as a reverse proxy to send traffic to an application, it works like below

NGINX-->AWS-NLB--> AWS-ELB-->Application.

AWS NLB and ELB load balancers are just listening on TCP port 443 and doesnt have any certificates, the application is having a self signed certificate.

I configured path based routing, some will got to S3 and some will got to application. To S3 it is working fine, but when I try to send to my application, am getting 502 bad gateway, here is what i found in the error log

[error] 12256#12256: *16 peer closed connection in SSL handshake while SSL handshaking to upstream, client: 54.254.192.230, server: rpinternet-7efda53723206039.elb.us-east-1.amazonaws.com, request: "GET / HTTP/1.1", upstream: "https://10.23.6.67:443/", host: "rpinternet-7efda53723206039.elb.us-east-1.amazonaws.com"
Below is my configuration file.

server {

listen 443;
server_name rpinternet-7efda53723206039.elb.us-east-1.amazonaws.com;

ssl_certificate /etc/nginx/cert.crt;
ssl_certificate_key /etc/nginx/cert.key;

ssl on;
ssl_session_cache builtin:1000 shared:SSL:10m;
proxy_ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
ssl_prefer_server_ciphers on;

access_log /var/log/nginx/jenkins.access.log;

location / {
proxy_pass https://cfinternal-d221bb72d9da80c9.elb.us-east-1.amazonaws.com;

}
location /spservice {
proxy_pass http://ui-service.s3-website-us-east-1.amazonaws.com/service;

}


}
I tried adding proxy_ssl_server_name on; just below the proxy pass line after that started getting the below error.

HTTP/1.1 426 Upgrade Required
Server: nginx/1.10.3 (Ubuntu)
Date: Mon, 18 Nov 2019 09:48:33 GMT
Content-Length: 0
Connection: keep-alive
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 107
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready