在WebSocket握手期间出错:意外的响应代码:在Google Cloud上部署时为400 [英] Error during WebSocket handshake: Unexpected response code: 400 when deployed on google cloud
问题描述
我制作了一个Django Channels应用程序,并在本地完美运行,但是当我将其部署到生产环境(Google Cloud Platform)时,它给了我:
I have made an app of Django Channels and its working perfect locally,but when I deployed it to production (Google Cloud Platform) it's giving me:
(索引):42到'wss://appname-263701.appspot.com/ws/chat/user2/'的WebSocket连接失败:WebSocket握手期间出错:意外的响应代码:400
我不知道问题是什么,这是WSS的问题吗?该应用程序在本地运行良好。
I can't figure whats the problem is, is it a problem of WSS? The app is working fine locally.
如果需要一些代码来审核,我也可以上传!只是需要一个指南,我将如何解决这个问题。
If need some code to review I can also upload that! Just need a guide how I can fix this
推荐答案
我认为您正在使用标准App Engine环境,而WebSockets是仅在以下环境中受支持App Engine 。因此,我建议您将环境从标准更改为灵活,请参见此处用于Flex中的app.yaml配置文件。这样,您将能够使用在App Engine上实现的WebSockets功能。
I think you are using Standard App Engine Environment, and WebSockets are only supported in the Flexible Environment for App Engine. So, I would suggest you to change the environment from Standard to Flexible, see here for the app.yaml Configuration File in Flex. This way, you will be able to use WebSockets functionality implemented on App Engine.
这篇关于在WebSocket握手期间出错:意外的响应代码:在Google Cloud上部署时为400的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!