我正在尝试使用由GCE提供支持的Spring启动应用程序使用Websocket。
我使用与=>相同的websocket代码https://github.com/spring-projects/spring-boot/tree/master/spring-boot-samples/spring-boot-sample-websocket-jetty
我正在使用HTTPS负载平衡,似乎负载均衡器不喜欢https,因为它可以在HTTP上工作,但不能在HTTPS上工作。
你可以在这里尝试我的蛇测试游戏(在简单的HTTP中)=> http://www.writecontrol.fr/websocket/snake.html
如果使用HTTPS =>测试相同的网址,则会出错https://www.writecontrol.fr/websocket/snake.html
我正在使用入口负载均衡器扩展/ v1beta1
SSL基于“秘密tls”=> https://cloud.google.com/endpoints/docs/openapi/enabling-ssl
因此,客户端和HTTPS负载均衡器之间存在SSL,但负载均衡器和应用程序实例之间不存在
登录应用程序实例似乎是正确的(无异常):
2017-12-20 20:07:04.986 INFO 5 --- [tp1875108260-24]监控:remoteAddr = 10.240.0.4,forwardedFor = 176.170.4.209,35.190.37.177,request = / websocket / snake / info GET :3毫秒,0 Ko
这是GCE负载平衡日志记录中的日志
httpRequest: {
remoteIp: "176.170.4.209"
requestMethod: "GET"
requestSize: "1940"
requestUrl: "https://www.writecontrol.fr/websocket/snake/370/5ho3g2ed/websocket"
responseSize: "414"
serverIp: "10.240.0.2"
status: 501
userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.84 Safari/537.36"
}
insertId: "148f3zg42bp37f"
jsonPayload: {
@type: "type.googleapis.com/google.cloud.loadbalancing.type.LoadBalancerLogEntry"
statusDetails: "websocket_handshake_failed"
}
logName: "projects/writecontrol-1055/logs/requests"
receiveTimestamp: "2017-12-20T18:47:23.815984409Z"
resource: {
labels: {
backend_service_name: ""
forwarding_rule_name: "k8s-fws-default-gateway-preprod-ingress--69a82c51321bbe98"
project_id: "writecontrol-1055"
target_proxy_name: "k8s-tps-default-gateway-preprod-ingress--69a82c51321bbe98"
url_map_name: "k8s-um-default-gateway-preprod-ingress--69a82c51321bbe98"
zone: "global"
}
type: "http_load_balancer"
}
severity: "WARNING"
timestamp: "2017-12-20T18:47:22.935633707Z"
trace: "projects/writecontrol-1055/traces/79e8cc41423a19b5a52f6c432257a7d6"
你有什么建议吗?