[英]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.