I use gRPC and WebSocket in a same port.
It use Content-Type header check
then I deploy on Koyeb. its only select one of HTTP or HTTP/2
on Nginx i use this profile
#PROXY-START/
underscores_in_headers on;
location ^~ / {
proxy_pass http://127.0.0.1:8000;
proxy_set_header Host $host;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $http_connection;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header REMOTE-HOST $remote_addr;
add_header X-Cache $upstream_cache_status;
}
location ^~ /proto.MyProto {
grpc_pass grpc://127.0.0.1:8000;
grpc_read_timeout 300d;
grpc_send_timeout 300d;
grpc_socket_keepalive on;
grpc_set_header Host $host;
grpc_set_header X-Real-IP $remote_addr;
grpc_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
grpc_set_header REMOTE-HOST $remote_addr;
access_log off;
}
#PROXY-END/
I dont know how to let koyeb work.