Renan Geraldo
Renan Geraldo

Reputation: 655

How to make HTTPS requests to AWS Load Balancer with Varnish and Nginx?

I have the following structure at AWS:

Route 53 DNS -> HTTPS Load Balancer(South America) -> Varnish(South America) -> Nginx(South America) -> Route 53 -> HTTPS Load Balancer(Oregon) -> Backend Ec2 instances(Oregon).

I know, it can be improved, but now I need to solve this thing. I can't connect to the Load Balancer in Oregon. I generated the certificates with AWS ACM. That's my config in Nginx:

   include /etc/nginx/conf.d/*.conf;

    server {
        listen       8080 default_server;
        listen       [::]:8080 default_server;
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {
         proxy_pass https://mydns:443/;
         proxy_set_header X-Real-IP $remote_addr;
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }
}

Should I need to configure SSL in Nginx? And if so, how can I get the certificate generated at AWS?

Thank you now!

Upvotes: 0

Views: 592

Answers (1)

Martin Do Santos
Martin Do Santos

Reputation: 137

Maybe, your problem is this:

You have a Load Balancer in South America, which it has a VPC with subnets and you want to connect to another Load Balancer located in Oregon which it has another VPC with other subnets.

Your nginx is located in South America and you want to connect to Oregon. Unless you are going to Internet (Your nginx must have access to Internet), there are two possibilites:

  • You're going to a public hosted zone but LB is not configured to receive traffic from your AWS's South America IPs.
  • You're going to a private hosted zone and VPC peering is needed to make the connection.

Upvotes: 1

Related Questions