【发布时间】:2017-05-16 15:41:29
【问题描述】:
我有一个在 openshift 免费层上运行的扩展 golang 应用程序。它使用位于https://github.com/zolamk/openshift-go 的自定义cartidge,我想将http 重定向到https,我尝试使用.htaccess 文件按照Technical FAQs 的指南进行操作,但这不起作用,可能是因为haproxy 用作负载均衡器,所以我的问题是 如果可能的话,我如何在不触及我的应用程序代码的情况下将 HTTP 流量重定向到 HTTPS? 也许通过更改 haproxy.cfg 文件,这是我的 `haproxy .cfg 文件看起来像
defaults
mode http
log global
option httplog
option dontlognull
option http-server-close
#option forwardfor except 127.0.0.0/8
option redispatch
retries 3
timeout http-request 10s
timeout queue 1m
timeout connect 10s
timeout client 1m
timeout server 1m
timeout http-keep-alive 10s
timeout check 10s
maxconn 128
listen stats 127.9.80.3:8080
mode http
stats enable
stats uri /
listen express 127.9.80.2:8080
cookie GEAR insert indirect nocache
option httpchk GET /
http-check expect rstatus 2..|3..|401
balance leastconn
server gear-586a4c732d52711f96000127-zolamk ex-std-node847.prod.rhcloud.com:65326 check fall 2 rise 3 inter 2000 cooki$
server local-gear 127.9.80.1:8080 check fall 2 rise 3 inter 2000 cookie local-586a492489f5cfef6a00002a
谢谢。
【问题讨论】: