Welcome! Log In Create A New Profile

Advanced

Loadbalance a website that only support https

Posted by wehrled 
Loadbalance a website that only support https
July 26, 2017 02:24AM
Hello,

I want to load-balance a web page that only supports https. For me it is ok to terminate the incoming https connection and create a new one.
I tried with this config:

http {

upstream myapp1 {
server page1.myregion.cloudapp.azure.com:443;
server page2.myregion.cloudapp.azure.com:443;
}

server {
listen 443 default ssl;

ssl_certificate /etc/nginx/certs/portal-cert.pem;
ssl_certificate_key /etc/nginx/certs/portal-key.pem;

location / {
proxy_pass https://myapp1;
proxy_ssl_verify off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_ssl_certificate /etc/nginx/certs/portal-cert.pem;
proxy_ssl_certificate_key /etc/nginx/certs/portal-key.pem;
proxy_ssl_server_name on;
proxy_ssl_protocols SSLv2 SSLv3 TLSv1.1 TLSv1.2 TLSv1.3;
}
}
}

The log say still http:
[25/Jul/2017:14:14:59 +0000] 1XX.XXX.XXX.238 - - - to: 1XX.XXX.XXX.XXX:443: GET / HTTP/1.1 upstream_response_time 0.342 msec 1500992099.260 request_time 0.342 500 3003 "-

Also the upstream web page give me a error page with Status 500 say http is not allowed because https is expected.

What did I miss?

Thanks,
Daniel
Re: Loadbalance a website that only support https
August 07, 2017 07:12AM
I think you should change proxy_pass value from https://myapp1; to myapp1; and add ssl on; parameter server section.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 331
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready