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