Hi yall, I am trying to set up a proxy for my gRPC server.
I am using NGINX as a reverse proxy locally ran using docker-compose. My
idea is to run the following:
api.domain.com/api to my regular Express server and api.domain.com/grpc my
regular grpc server.
I have the following on my nginx.conf
events {
worker_connections 1024;
}
http {
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# All other servers, eg: admin dashboard, client website etc
server {
listen 80;
http2 on;
server_name http://api.domain.com;
location /api {
proxy_pass http://host.docker.internal:5001;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# WebSocket support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
}
location /grpc {
grpc_pass grpc://host.docker.internal:50051;
}
}
}
I am using nginx:alpine.
Calling grpc://host.docker.internal:50051 on postman works fine but trying
to call http:api.dev-local.com/grpc wont work.
curl -I on the domain shows HTTP/1.1 regardless of setting : http2 on;.
Now I also plan to put this in a EC2 server for production, I use nginx
there but I think its gonna be easier to set it up using ALB.
Any ideas on why this is not working?
--
You received this message because you are subscribed to the Google Groups
"grpc.io" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/grpc-io/15fbc1ba-768f-4e60-8d67-672bd7194c01n%40googlegroups.com.