haproxy - HA 代理 - 在同一域 ACL 上同时使用 HTTP 和 HTTPS
问题描述
我在多台主机上有一个有效的 HA-Proxy 转发请求 HTTPS。对于一台主机,HTTP 流量应保持为纯 HTTP
我知道重定向规则可以避免一个规则,但我不清楚我是否需要声明两个后端
现有代码
frontend HTTPIN
bind localhost:80
bind localhost:443 ssl crt-list /etc/haproxy/ssl/crt-list
http-request set-header X-Forwarded-Port %[dst_port]
http-request add-header X-Forwarded-Proto https if { ssl_fc }
redirect scheme https code 301 if !{ ssl_fc }
acl host_HOST1 hdr(host) -i sub.domain.com
use_backend HOST if host_HOST1
backend HOST
server host_ip host_ip:443 check ssl check-ssl verify none
http-check expect rstring ^200\ OK(.*)$
目标是让http://sub.domain.com到 host_ip:80 和https://sub.domain.com到 host_ip:443。
谢谢您的帮助!
解决方案
推荐阅读
- node.js - 如何在连接范围之外引用 socket.id 或以可以在连接范围之外引用的方式存储它?
- electron - 在具有上下文隔离的渲染器中使用电子保存对话框
- c# - 总偶数数组
- java - 在java中创建类对象而不使用类名方法的替代方法
- javascript - 如何获取数组中唯一值的*索引*
- ethereum - 从零地址发送交易
- javascript - Angular Uncaught (in promise): ChunkLoadError: Loading chunk XXXfailed
- mysql - mariaDB 上的 json crud
- c++ - 从 Excel 创建 DLL 并使用它
- excel - POwershell 未从 excel 文件中读取 MM/DD/YYYY 日期列