amazon-web-services - ALB -> HAPROXY Websocket 连接不工作
问题描述
很长一段时间后在社区发帖。我正在尝试设置这样的基础设施。
ALB -> HAPROXY ec2 节点 -> 网络服务器。
我能够成功启动应用程序并通过 http 和 https 访问它。
我试图简单地将 websocket 请求代理到演示回显测试应用程序,但它失败了。我验证了 Haproxy 配置,对我来说看起来不错,但没有任何效果。
这是 Haproxy 配置。
defaults
log global
mode http
option httplog
option dontlognull
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
frontend http-traffic
bind *:80
acl is_websocket hdr(Upgrade) -i WebSocket
redirect scheme https if is_websocket
use_backend websocket if is_websocket
default_backend tomcat
frontend https-traffic
bind *:443 ssl crt /etc/ssl/private/mydomain.pem
reqadd X-Forwarded-Proto:\ https
acl is_websocket hdr(Upgrade) -i WebSocket
use_backend websocket if is_websocket
default_backend tomcat
frontend health
bind *:8080
acl backend_dead nbsrv(tomcat) lt 1
monitor-uri /haproxy_status
monitor fail if backend_dead
backend tomcat
reqirep ^([^\ :]*)\ /(.*) \1\ /ImageServlet\2
server app-i-0000000000f x.x.x.x:8080 cookie app-i-0000000000f check
server app-i-0000000000f x.x.x.x:8080 cookie app-i-0000000000f check
backend websocket
http-request set-header Host demos.kaazing.com
http-request set-path /echo
server ws demos.kaazing.com:443/echo ssl verify none
感谢你的帮助。谢谢
解决方案
推荐阅读
- postgresql - 在 postgres 中选择 json 值 frob jsonb 列
- python - 如何提高pyqtgraph中大量TextItem的绘制速度
- xamarin - 在 Uno 平台上如何使用 Preferences.Set 命令
- java - Saxon 10 HE - 每个 Java 扩展类是否需要一个命名空间?
- ios - SwiftUI 具有 @Environment(\.presentationMode) 用于消除视图行为不端
- redhat - 安全套接字代理代理侦听器错误
- mysql - MYSQL传递存储过程变量IN子句
- docker - 一台服务器上的两个rabbitmq实例与docker组成如何更改默认端口
- sql - Databricks 笔记本 - 从表中返回所有值
- ionic-framework - 图标未在离子中加载