Spring-WebSocket 跨域访问403错误解决


我是采用的XML配置的方式,跨域访问记得在<websocket:handlers>标签里添加 allowed-origins属性

具体如下:

<websocket:handlers allowed-origins="*">
        <websocket:mapping path="/cb/status" handler="cbSocketEndPoint"/>
        <websocket:mapping path="/cb/log_socket" handler="logSocketEndPoint"/>
        <websocket:handshake-interceptors>
            <ref bean="webSocketInterceptor"/>
        </websocket:handshake-interceptors>
</websocket:handlers>

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM