You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/05/26 06:39:57 UTC

[GitHub] [apisix-ingress-controller] shuoshadow edited a comment on issue #495: request help: websocket reqeust return 415 code

shuoshadow edited a comment on issue #495:
URL: https://github.com/apache/apisix-ingress-controller/issues/495#issuecomment-848507043


   > @shuoshadow How did you send requests? Please give us a minimal reproducible case.
   
   frontend:
   
   const initSocket = () => {
       const socketURI = `${WEBSOCKET_URL_OBJ[props.namespace]}/api/v1/pod/exec/${props.namespace}/${props.podName}`
   
       socketRef.current = new WebSocket(socketURI)
       socketOnClose()
       socketOnOpen()
       socketOnError()
     }
   
     const socketOnClose = () => {
       socketRef.current.onclose = () => {
         socketRef.current.close()
         termRef.current.write('connet is closed!!!')
         console.log('close socket')
       }
     }
   
     const socketOnOpen = () => {
       socketRef.current.onopen = () => {
         initTerm()
       }
     }
   
   backend:
   
   	logger.Debug("in ExecPod")
   	if !ctx.IsWebsocket() {
   		ctx.JSON(http.StatusUnsupportedMediaType, hr.ErrResponse{hr.ErrorData{hr.ErrorCodePodExecError, "===not websocket request==="}})
   		return
   	}
   
   it works right by nginx-ingress


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org