GCE负载平衡器HTTPS和HTTP IP [英] GCE Load Balancer HTTPS and HTTP IP
问题描述
我已经在GCE上用HTTP负载平衡设置了一个应用程序(Django和nginx)。
我创建了2个全局转发规则。 1用于HTTP,另一个用于HTTPS。这给了我2个IP。
- https:130.211.11.247:443
- http:130.211。 15.15
$ b我在我的域名dvotedfan.com的DNS A记录中添加了HTTPS IP(130.211.11.247)我访问
通过这样做,您可以为您的应用程序/网站指定一个DNS A记录,以查找http和https流量。 / p>
请确保您创建了静态IP ,然后在负载均衡器中创建/编辑转发规则。
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.
解决方案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.
这篇关于GCE负载平衡器HTTPS和HTTP IP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!