带有websockets的Java Spring(STOMP.JS)因403握手而失败 [英] Java Spring with websockets (STOMP.JS) fails with 403 handshake

查看:407
本文介绍了带有websockets的Java Spring(STOMP.JS)因403握手而失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨朋友

我在部署使用websockets的Java Spring启动应用程序时遇到问题(在websocket上使用Stomp协议)当我转到azure web app的已部署URL时,它失败并出现以下错误:

I have an issue with deploying the Java Spring boot app that uses websockets (Stomp protocol over websocket) when I go to the deployed URL for azure web app it fails with error below:

websocket.js:6 WebSocket连接到'wss: //ctiadapter.azurewebsites.net/ws/806/0qbqlnon/websocket'失败:WebSocket握手期间出错:意外的响应代码:403

websocket.js:6 WebSocket connection to 'wss://ctiadapter.azurewebsites.net/ws/806/0qbqlnon/websocket' failed: Error during WebSocket handshake: Unexpected response code: 403

任何帮助将不胜感激。请注意,我已经在azure web app的应用程序设置中启用了Web套接字。

any help would be greatly appreciated. Please note that I already enabled web socket in the application settings in azure web app.

Arash

推荐答案

请仔细检查问题是否归因于CORS配置并确保在Azure门户中启用了Web套接字。  如果
您的需求适合并且为了隔离问题,您可以尝试配置's
etAllowedOrigins(" *" )在网络套接字配置中,看看是否有帮助。 

看一下这个文件部分
Spring Boot
有关在App Service上托管Java Spring应用程序的详细步骤。


这篇关于带有websockets的Java Spring(STOMP.JS)因403握手而失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆