A go GRPC server is running on an amazon Linux 2 EC2 instance. GRPC web wrapper is used, which makes the server available for a NEXTjs application. Two ports are exposed. One for regular GRPC requests and another for GRPC web requests. Nginx is configured to reverse proxy the requests, and TLS is enabled.
Regular GRPC server
server {
listen 8000 http2;
listen [::]:8000;
server_name example.org;
location / {
grpc_pass grpc://localhost:5000;
grpc_read_timeout 300;
grpc_send_timeout 300;
}
}
GRPC web server
server {
server_name example.org;
location / {
proxy_http_version 1.1;
proxy_pass http://127.0.0.1:5001;
proxy_read_timeout 300;
proxy_connect_timeout 300;
proxy_send_timeout 300;
}
access_log /var/log/nginx/example.org/access.log;
error_log /var/log/nginx/example.org/error.log;
listen [::]:443 ssl; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/example.org/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/example.org/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
A server-side stream has been implemented. It sends an initial response soon after the connection and further responses for internal events. It works fine for regular GRPC requests but not for GRPC web.
Once the client makes a request, the status goes to pending, and once the stream closes, the client gets the response. Interim responses are not sent from the server. Requests from the client are logged in the server. They reach the server immediately. But the response it delayed. Sometimes, after 1 minute, the client gets this error - "(failed)net::ERR_INCOMPLETE_CHUNKED_ENCODING" I expect the response to be similar to regular GRPC calls.