I'm trying to have a single server on nginx serving both http2 routes and traditional http1 routes, my problem is that I cannot get it to play nicely.
When I try to access my app on the subfolder, that runs on gunicorn+flask, I get a download file with some binary
How can I serve both?
server {
listen 80 http2;
access_log /dev/stdout main;
rewrite_log on;
error_log /dev/stdout debug;
location /some.Service {
grpc_pass grpc://srvadd:10116;
}
location /password-reset {
proxy_pass http://flask:8000;
}
}
hm, serving both http and http2 traffic under the same nginx server should work. This is one example nginx.conf that works for us
server {
listen 8080;
listen 8443 http2;
server_name localhost;
location / {
grpc_pass localhost:9090;
}
}
I am not entirely sure, but does port 80 work with http2? I think there might be some restriction on what port number you can use with http2?
another slightly more involved example
server {
listen [::]:$0;
listen [::]:$1 http2;
server_name localhost;
location /grpc.gateway.testing.EchoService/ {
grpc_pass localhost:$2;
grpc_channel_reuse on;
grpc_ssl $3;
grpc_ssl_target_name_override $4;
grpc_ssl_pem_root_certs "$5";
grpc_ssl_pem_private_key "$6";
grpc_ssl_pem_cert_chain "$7";
grpc_client_liveness_detection_interval 10ms;
add_header Access-Control-Allow-Origin * always;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With