Test Websocket app


#1

Hi,

I try to understand how to use kong to interact with websocket application.

  1. create service and ingress to access external websocket.org

kind: Service
apiVersion: v1
metadata:
name: proxy-to-websocket
namespace: default
spec:
ports:

  • protocol: TCP
    port: 80
    type: ExternalName
    externalName: websocket.org

apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name: transform-request-to-websocket
config:
remove:
headers: host


apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: proxy-from-k8s-to-websocket
annotations:
plugin.konghq.com: transform-request-to-websocket
spec:
rules:

  • host: echo.websocket.org
    http:
    paths:
    • path: /
      backend:
      serviceName: proxy-to-websocket
      servicePort: 80

  1. Run

curl -X GET --url http://100.22.4.25:31329 -H “host: echo.websocket.org” -H “Connection: Upgrade” -H “Upgrade: Websocket” -i -N

404 Not found

  1. Run

curl -X GET --url http://100.22.4.25:31329 -H “host: echo.websocket.org

No error

Do I miss something when config service and ingress?

Thanks.