【问题标题】:HAProxy 1.5 Redirect with Exchange 2013 OWAHAProxy 1.5 重定向与 Exchange 2013 OWA
【发布时间】:2023-08-30 21:16:02
【问题描述】:

我已将 HAproxy 1.5.4 版设置为 2 个 Exchange 多角色服务器的 NLB。

当用户在浏览器中输入平面主机名“webmail”时,我现在正试图让重定向工作。我希望它重定向到https://webmail.domain.com/owa

这是我现有的 haproxy 配置。

global
log /dev/log    local0
log /dev/log    local1 notice
chroot /var/lib/haproxy
stats socket /run/haproxy/admin.sock mode 660 level admin
stats timeout 30s
user haproxy
group haproxy
daemon

defaults
log global
mode    tcp
balance roundrobin
retries 3
option redispatch
maxconn 10000
    timeout connect 5000
    timeout client  50000
    timeout server  50000
errorfile 400 /etc/haproxy/errors/400.http
errorfile 403 /etc/haproxy/errors/403.http
errorfile 408 /etc/haproxy/errors/408.http
errorfile 500 /etc/haproxy/errors/500.http
errorfile 502 /etc/haproxy/errors/502.http
errorfile 503 /etc/haproxy/errors/503.http
errorfile 504 /etc/haproxy/errors/504.http


listen OWA 10.20.100.120:443
option httpchk GET /owa/healthcheck.h
http-check expect status 200
server EX2013A.domain.com 10.20.100.126 check port 80
server EX2013B.domain.com 10.20.100.127 check port 80

listen EAC 10.20.100.131:443
option httpchk /eac/healthcheck.h
server EX2013A.domain.com 10.20.100.126 check port 80
server EX2013B.domain.com 10.20.100.127 check port 80

listen EWS 10.20.100.122:443
option httpchk get /ews/healthcheck.h
server EX2013A.domain.com 10.20.100.126 check port 80
server EX2013B.domain.com 10.20.100.127 check port 80

listen OAB 10.20.100.123:443
option httpchk get /oab/healthcheck.h
server EX2013A.domain.com 10.20.100.126 check port 80
server EX2013B.domain.com 10.20.100.127 check port 80


listen Autodiscover 10.20.100.132:443
option httpchk get /autodiscover/healthcheck.h
server EX2013A.domain.com 10.20.100.126 check port 80
server EX2013B.domain.com 10.20.100.127 check port 80

listen OA 10.20.100.133:443
option httpchk get /rpc/healthcheck.h
server EX2013A.domain.com 10.20.100.126 check port 80
server EX2013B.domain.com 10.20.100.127 check port 80

listen SMTP 10.20.100.120:25
option smtpchk
server EX2013A.domain.com 10.20.100.126 check port 25
server EX2013B.domain.com 10.20.100.127 check port 25


listen stats 0.0.0.0:4000
mode http
balance
timeout client 5000
timeout connect 4000
timeout server 30000
stats enable
stats hide-version
stats uri /stats
stats auth admin:password

谢谢

【问题讨论】:

    标签: exchange-server cas haproxy outlook-web-app nlb


    【解决方案1】:

    您没有准确说明您使用的是哪个版本的 HAProxy,所以我假设这是 1.5。

    首先,现在已弃用在部分描述行上创建具有绑定 IP:port 的侦听部分。 其次,为了更清楚,我还要在服务器线路上添加443端口。

    请这样写你的 OWA 部分:

    listen OWA
      bind 10.20.100.120:443
      option httpchk GET /owa/healthcheck.h
      http-check expect status 200
      server EX2013A.domain.com 10.20.100.126:443 check port 80
      server EX2013B.domain.com 10.20.100.127:443 check port 80
    

    现在,要执行重定向,您需要一个专门用于响应 HTTP 清除流量的前端:

    frontend OWA_http
      bind 10.20.100.120:80
      http-request redirect location https://%[req.hdr(Host)]/owa/
    

    巴蒂斯特

    【讨论】:

    • 这似乎有效,但只有大约 50% 的时间取决于浏览器。有时我会收到“无法显示页面”消息。其他时候,它会将平面名称 webmail 重定向到 webmail 而不是 FQDN。在 Google Chrome 上,它实际上从不重定向到 FQDN。对此有何想法?