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 03:38:06 UTC
[GitHub] [apisix-ingress-controller] shuoshadow opened a new issue #495: request help: websocket reqeust return 415 code
shuoshadow opened a new issue #495:
URL: https://github.com/apache/apisix-ingress-controller/issues/495
### Issue description
![image](https://user-images.githubusercontent.com/10016360/119598950-913a3100-be16-11eb-8817-8684da9c4213.png)
![image](https://user-images.githubusercontent.com/10016360/119599041-c777b080-be16-11eb-8326-1cff851e1823.png)
### Environment
* your apisix-ingress-controller version (output of `apisix-ingress-controller version --long`);
* your Kubernetes cluster version (output of `kubectl version`);
* if you run apisix-ingress-controller in Bare-metal environment, also show your OS version (`uname -a`).
--
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
[GitHub] [apisix-ingress-controller] tokers commented on issue #495: request help: websocket reqeust failed
Posted by GitBox <gi...@apache.org>.
tokers commented on issue #495:
URL: https://github.com/apache/apisix-ingress-controller/issues/495#issuecomment-849280736
@lingsamuel Please take a look when you have time.
--
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
[GitHub] [apisix-ingress-controller] shuoshadow edited a comment on issue #495: request help: websocket reqeust return 415 code
Posted by GitBox <gi...@apache.org>.
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
[GitHub] [apisix-ingress-controller] shuoshadow commented on issue #495: request help: websocket reqeust failed
Posted by GitBox <gi...@apache.org>.
shuoshadow commented on issue #495:
URL: https://github.com/apache/apisix-ingress-controller/issues/495#issuecomment-848615603
> What are your apisix-ingress-controller and apisix version?
```shell
bash-5.0# /usr/bin/apisix version
/usr/local/openresty/luajit/bin/luajit ./apisix/cli/apisix.lua version
2.5
```
```shell
/ingress-apisix # ./apisix-ingress-controller --version
apisix-ingress-controller version 0.5.0--go1.13.8
```
--
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
[GitHub] [apisix-ingress-controller] shuoshadow edited a comment on issue #495: request help: websocket reqeust failed
Posted by GitBox <gi...@apache.org>.
shuoshadow edited a comment on issue #495:
URL: https://github.com/apache/apisix-ingress-controller/issues/495#issuecomment-848615603
> What are your apisix-ingress-controller and apisix version?
```shell
bash-5.0# /usr/bin/apisix version
/usr/local/openresty/luajit/bin/luajit ./apisix/cli/apisix.lua version
2.5
```
```shell
/ingress-apisix # ./apisix-ingress-controller --version
apisix-ingress-controller version 0.5.0--go1.13.8
```
```shell
apisix image: apache/apisix:2.5-alpine
apisix-ingress-controller image: apache/apisix-ingress-controller:0.5.0
```
--
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
[GitHub] [apisix-ingress-controller] shuoshadow edited a comment on issue #495: request help: websocket reqeust return 415 code
Posted by GitBox <gi...@apache.org>.
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:
```javascript
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:
```golang
logger.Debug("in ExecPod")
if !ctx.IsWebsocket() {
ctx.JSON(http.StatusUnsupportedMediaType, hr.ErrResponse{hr.ErrorData{hr.ErrorCodePodExecError, "===not websocket request==="}})
return
}
```
![image](https://user-images.githubusercontent.com/10016360/119616001-ad4bcb80-be32-11eb-8dc3-2e2fab0819a5.png)
415 code was return by backend, !ctx.IsWebsocket()
```golang
func (c *Context) IsWebsocket() bool {
if strings.Contains(strings.ToLower(c.requestHeader("Connection")), "upgrade") &&
strings.EqualFold(c.requestHeader("Upgrade"), "websocket") {
return true
}
return false
}
```
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
[GitHub] [apisix-ingress-controller] shuoshadow commented on issue #495: request help: websocket reqeust return 415 code
Posted by GitBox <gi...@apache.org>.
shuoshadow commented 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
[GitHub] [apisix-ingress-controller] shuoshadow edited a comment on issue #495: request help: websocket reqeust return 415 code
Posted by GitBox <gi...@apache.org>.
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
[GitHub] [apisix-ingress-controller] shuoshadow edited a comment on issue #495: request help: websocket reqeust return 415 code
Posted by GitBox <gi...@apache.org>.
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
}
![image](https://user-images.githubusercontent.com/10016360/119616001-ad4bcb80-be32-11eb-8dc3-2e2fab0819a5.png)
=====
415 code was return by backend, !ctx.IsWebsocket()
func (c *Context) IsWebsocket() bool {
if strings.Contains(strings.ToLower(c.requestHeader("Connection")), "upgrade") &&
strings.EqualFold(c.requestHeader("Upgrade"), "websocket") {
return true
}
return false
}
=====
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
[GitHub] [apisix-ingress-controller] shuoshadow edited a comment on issue #495: request help: websocket reqeust return 415 code
Posted by GitBox <gi...@apache.org>.
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
}
![image](https://user-images.githubusercontent.com/10016360/119616001-ad4bcb80-be32-11eb-8dc3-2e2fab0819a5.png)
415 code was return by backend, !ctx.IsWebsocket()
```golang
func (c *Context) IsWebsocket() bool {
if strings.Contains(strings.ToLower(c.requestHeader("Connection")), "upgrade") &&
strings.EqualFold(c.requestHeader("Upgrade"), "websocket") {
return true
}
return false
}
```
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
[GitHub] [apisix-ingress-controller] tokers commented on issue #495: request help: websocket reqeust return 415 code
Posted by GitBox <gi...@apache.org>.
tokers commented on issue #495:
URL: https://github.com/apache/apisix-ingress-controller/issues/495#issuecomment-848490666
@shuoshadow How did you send requests? Please give us a minimal reproducible case.
--
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
[GitHub] [apisix-ingress-controller] shuoshadow edited a comment on issue #495: request help: websocket reqeust return 415 code
Posted by GitBox <gi...@apache.org>.
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
}
![image](https://user-images.githubusercontent.com/10016360/119616001-ad4bcb80-be32-11eb-8dc3-2e2fab0819a5.png)
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
[GitHub] [apisix-ingress-controller] tokers commented on issue #495: request help: websocket reqeust failed
Posted by GitBox <gi...@apache.org>.
tokers commented on issue #495:
URL: https://github.com/apache/apisix-ingress-controller/issues/495#issuecomment-848608947
What are your apisix-ingress-controller and apisix version?
--
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
[GitHub] [apisix-ingress-controller] shuoshadow commented on issue #495: request help: websocket reqeust return 415 code
Posted by GitBox <gi...@apache.org>.
shuoshadow commented on issue #495:
URL: https://github.com/apache/apisix-ingress-controller/issues/495#issuecomment-848516933
![image](https://user-images.githubusercontent.com/10016360/119615812-6a89f380-be32-11eb-9c99-91992d571f1a.png)
--
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
[GitHub] [apisix-ingress-controller] shuoshadow edited a comment on issue #495: request help: websocket reqeust return 415 code
Posted by GitBox <gi...@apache.org>.
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
}
![image](https://user-images.githubusercontent.com/10016360/119615846-783f7900-be32-11eb-995f-add75b95cd09.png)
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
[GitHub] [apisix-ingress-controller] shuoshadow removed a comment on issue #495: request help: websocket reqeust return 415 code
Posted by GitBox <gi...@apache.org>.
shuoshadow removed a comment on issue #495:
URL: https://github.com/apache/apisix-ingress-controller/issues/495#issuecomment-848516933
![image](https://user-images.githubusercontent.com/10016360/119615812-6a89f380-be32-11eb-9c99-91992d571f1a.png)
--
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
[GitHub] [apisix-ingress-controller] shuoshadow commented on issue #495: request help: websocket reqeust failed
Posted by GitBox <gi...@apache.org>.
shuoshadow commented on issue #495:
URL: https://github.com/apache/apisix-ingress-controller/issues/495#issuecomment-848604466
apisix pod logs
```shell
2021/05/26 09:06:29 [error] 43#43: *11 [lua] config_etcd.lua:550: failed to fetch data from etcd: failed to check item data of [/apisix/routes] err:failed to validate the 'vars' expression: rule too short, etcd key: /apisix/routes, context: ngx.timer
2021/05/26 09:06:29 [error] 47#47: *97 [lua] config_etcd.lua:550: failed to fetch data from etcd: failed to check item data of [/apisix/routes] err:failed to validate the 'vars' expression: rule too short, etcd key: /apisix/routes, context: ngx.timer
2021/05/26 09:06:29 [error] 41#41: *45 [lua] config_etcd.lua:550: failed to fetch data from etcd: failed to check item data of [/apisix/routes] err:failed to validate the 'vars' expression: rule too short, etcd key: /apisix/routes, context: ngx.timer
2021/05/26 09:06:29 [error] 44#44: *76 [lua] config_etcd.lua:550: failed to fetch data from etcd: failed to check item data of [/apisix/routes] err:failed to validate the 'vars' expression: rule too short, etcd key: /apisix/routes, context: ngx.timer
2021/05/26 09:06:29 [error] 42#42: *32 [lua] config_etcd.lua:550: failed to fetch data from etcd: failed to check item data of [/apisix/routes] err:failed to validate the 'vars' expression: rule too short, etcd key: /apisix/routes, context: ngx.timer
```
when i set websocket true by dashboard
--
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
[GitHub] [apisix-ingress-controller] shuoshadow edited a comment on issue #495: request help: websocket reqeust failed
Posted by GitBox <gi...@apache.org>.
shuoshadow edited a comment on issue #495:
URL: https://github.com/apache/apisix-ingress-controller/issues/495#issuecomment-848615603
> What are your apisix-ingress-controller and apisix version?
```shell
bash-5.0# /usr/bin/apisix version
/usr/local/openresty/luajit/bin/luajit ./apisix/cli/apisix.lua version
2.5
```
```shell
/ingress-apisix # ./apisix-ingress-controller --version
apisix-ingress-controller version 0.5.0--go1.13.8
```
apisix image: apache/apisix:2.5-alpine
--
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
[GitHub] [apisix-ingress-controller] shuoshadow edited a comment on issue #495: request help: websocket reqeust return 415 code
Posted by GitBox <gi...@apache.org>.
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:
```javascript
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
}
![image](https://user-images.githubusercontent.com/10016360/119616001-ad4bcb80-be32-11eb-8dc3-2e2fab0819a5.png)
415 code was return by backend, !ctx.IsWebsocket()
```golang
func (c *Context) IsWebsocket() bool {
if strings.Contains(strings.ToLower(c.requestHeader("Connection")), "upgrade") &&
strings.EqualFold(c.requestHeader("Upgrade"), "websocket") {
return true
}
return false
}
```
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