Load balancer and redirect to https


#1

HI

I would like to setup my Load Balancer to distribute the load to
different servers, and i would also like to forward all of the incoming
http request to the https port. Here is my configuration:

upstream mysvr {
server server1:443
server server2:443
}

server {
listen 80;
server_name www.server.com server.com;
rewrite ^/(.*) https://$server_name/$1 permanent;

    }

server {
listen 443;
server_name www.server.com server.com;

    ssl                  on;
    ssl_certificate      /etc/ssl/certs/myssl.crt;
    ssl_certificate_key  /etc/ssl/private/myssl.key;

    proxy_pass  https://mysvr;

}

This doesn’t work as expected, any help is appreciated.