failed: Error during WebSocket handshake: Unexpected response code: 403
See original GitHub issuemy config
var express = require('express');
var proxy = require('http-proxy-middleware');
var wsProxy = proxy('/', {
target: 'http://preview-hgpos.behuntergatherer.com',
changeOrigin: true, // for vhosted sites, changes host header to match to target's host
ws: true, // enable websocket proxy
logLevel: 'debug'
})
var app = express()
app.use('/', express.static(__dirname))
app.use(wsProxy) // add the proxy to express
var server = app.listen(8070)
server.on('upgrade', wsProxy.upgrade) // optional: upgrade externally
my terminal
Proxy created: / -> http://preview-hgpos.behuntergatherer.com
[HPM] Subscribed to http-proxy events: [ 'error', 'close' ]
[DEMO] Server: listening on port 3000
[DEMO] Opening: http://localhost:3000
[HPM] GET /websocket/webSocketIMServer -> http://preview-hgpos.behuntergatherer.com
[HPM] Upgrading to WebSocket
browser console error
WebSocket connection to 'ws://localhost:8070/websocket/webSocketIMServer' failed: Error during WebSocket handshake: Unexpected response code: 403
I need help, Thx!
Issue Analytics
- State:
- Created 5 years ago
- Comments:6
Top Results From Across the Web
Error during WebSocket handshake: Unexpected response code
WebSocket connection to 'ws://192.168.X.XYZ:8080/test' failed: Error during WebSocket handshake: Unexpected response code: 403.
Read more >fixing [Error during WebSocket handshake: Unexpected ...
fixing [Error during WebSocket handshake: Unexpected response code: 403] when serving html from different server #644.
Read more >Failed: Error during WebSocket handshake: Unexpected ...
Failed: Error during WebSocket handshake: Unexpected response code: 403 _initWebSocket ... Check your nginx conf - looks like your app cannot ...
Read more >Error during WebSocket handshake: Unexpected response code
Hello everyone, I want to implement a notification system in my SAPUI5 application developed with SAP Web IDE.
Read more >WebSocket : Unexpected response code: 403 - WordPress.org
WebSocket connection to 'wss://public-api.wordpress.com/pinghub/wpcom/me/newest-note-data' failed: Error during WebSocket handshake: Unexpected response ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
To translate the last comment: “My problem has been solved because the backend framework restricts websocket requests from other domains, and the backend can be connected by removing the restrictions.”
@kellywang1234 不好意思,时间太久忘记了,好像是跨域的问题,配置一下 CORS 就可以了