简体   繁体   English

Sailsjs:WebSocket握手期间出错:意外的响应代码:400

[英]Sailsjs: Error during WebSocket handshake: Unexpected response code: 400

Sails 1 version giving below error and redirecting back to login screen when tried to login instead of taking to welcome page. 航行1版本会给出以下错误,并在尝试登录时重定向到登录屏幕,而不是转到欢迎页面。

400 Bad Request 400错误的要求

ws://xyz.com/socket.io/?__sails_io_sdk_version=1.2.1&__sails_io_sdk_platform=browser&__sails_io_sdk_language=javascript&EIO=3&transport=websocket

One more error: 还有一个错误:

403 Request Forbidden 403请求禁止

Not able to register or login. 无法注册或登录。 Temporarily disabled csrf in security.js without finding the solution so far. 暂时在security.js禁用了csrf,但至今未找到解决方案。

Has anybody faced such issue, and may i know if this fix is possible from application level or do we need to modify apache settings? 有没有人遇到过这样的问题,我是否可以从应用程序级别了解此修复程序,还是我们需要修改apache设置?

By adding below code inside apache configuration: 通过在apache配置内添加以下代码:

RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /(.*) ws://localhost:1337/$1 [P,L]
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
RewriteRule /(.*) http://localhost:1337/$1 [P,L]

ProxyPassReverse / http://localhost:1337/

The problem was resolved 问题已解决

After doing the changes in the config file run the below command to check the syntax of apache. 在配置文件中进行更改后,运行以下命令以检查apache的语法。

httpd -t

After the syntax is correct use the below command to restart apache 语法正确后,使用以下命令重新启动apache

service httpd restart

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 与'ws:// ... / websocket'的Meteor WebSocket连接失败:WebSocket握手期间出错:意外的响应代码:400 - Meteor WebSocket connection to 'ws://…/websocket' failed: Error during WebSocket handshake: Unexpected response code: 400 WebSocket 连接失败:WebSocket 握手期间出错:意外响应代码:400 - WebSocket connection failed: Error during WebSocket handshake: Unexpected response code: 400 连接时的Socket Io错误(WebSocket握手过程中的错误:意外的响应代码:400) - Socket Io Error on connection (Error during WebSocket handshake: Unexpected response code: 400) 失败:WebSocket握手期间出错:意外的响应代码:使用Arduino的400 - failed: Error during WebSocket handshake: Unexpected response code: 400 using Arduino Websocket:WebSocket握手期间出错:意外的响应代码:504 - Websocket : Error during WebSocket handshake: Unexpected response code: 504 Websocket - WebSocket 握手期间出错:意外的响应代码:404 - Websocket - Error during WebSocket handshake: Unexpected response code: 404 javascript-WebSocket握手期间错误:意外的响应代码:404 - javascript - Error during WebSocket handshake: Unexpected response code: 404 WebSocket 握手期间出错:意外的响应代码:500 - Error during WebSocket handshake: Unexpected response code: 500 SignalR-WebSocket握手期间错误:意外的响应代码:504 - SignalR - Error during WebSocket handshake: Unexpected response code: 504 WebSocket 握手期间的 WebSockets WS 错误:意外的响应代码:200 - WebSockets WS error during WebSocket handshake: Unexpected response code: 200
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM