Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
314 views
in Technique[技术] by (71.8m points)

Websockets on google cloud endpoints

I am trying to get websockets working on google cloud endpoints but am getting a 400 response. My setup is as follows:

User => Cloud endpoints => Target instance on cloud run.

We have an openapi2 description that describes where all target instances are, it is here I think the problem lies, since calling the target instance directly works fine.

  /socket.io:
    get:
      operationId: Websocket_passthrough_get
      summary: Allows client to establish a websocket connection.
      x-google-backend:
        address: 'https://adress-to-server
        path_translation: APPEND_PATH_TO_ADDRESS
        disable_auth: true
      responses:
        '101':
          description: Switching Protocols
        '200':
          description: Ok

I have tried adding a path with info on where to send the websocket requests, but I can see in the logs that it hits the proxy with "wss" but at the final destination it has changed to "https" and gets 400.

When I did this with nginx, I had to add headers for "upgrading" the connection, and it feels like there is a similar magical configuration I can make here as well.

Has anyone got this working and in that case: how?

question from:https://stackoverflow.com/questions/66058718/websockets-on-google-cloud-endpoints

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...