GCE Load Balancer HTTPS and HTTP IP

2019-02-26 05:37发布

问题:

I've setup an application (Django and nginx) at GCE with an HTTP Load Balancing.

I created 2 global forwarding rule. 1 for HTTP and the other for HTTPS. This gave me 2 ip.

  • https: 130.211.11.247:443
  • http: 130.211.15.15

I added the HTTPS IP (130.211.11.247) in my DNS A Record for my domain dvotedfan.com and that works perfectly if I access https://dvotedfan.com

My problem is that it wont work if I try http://dvotedfan.com (Error 404). If I use the IP provided by the HTTP IP at 130.211.15.15 will it work.

Since I know I can't add more then 1 IP for a DNS A Record how do I make the http://dvotefan.com requests work.

回答1:

You should use the same IP for both forwarding rules (http and https) like in this example:

By doing so, you can have a single DNS A record pointing to your application/website for http and https traffic.

Just make sure, you have created a static IP before you create/edit forwarding rules in your load balancer.