Created
March 22, 2018 20:04
-
-
Save FZambia/8627feaeca8dc99a1ca39581a58a21d9 to your computer and use it in GitHub Desktop.
Nginx to proxy Websocket and GRPC traffix on the same port
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
events { | |
} | |
http { | |
log_format main '$remote_addr - $remote_user [$time_local] "$request" ' | |
'$status $body_bytes_sent "$http_referer" ' | |
'"$http_user_agent"'; | |
map $http_upgrade $connection_upgrade { | |
default upgrade; | |
'' close; | |
} | |
server { | |
listen 443 ssl http2; | |
ssl_certificate cert.pem; | |
ssl_certificate_key key.pem; | |
access_log /tmp/access.log main; | |
error_log /tmp/error.log error; | |
proxy_buffering off; | |
proxy_set_header X-Real-IP $remote_addr; | |
proxy_set_header X-Scheme $scheme; | |
proxy_set_header Host $http_host; | |
location /proto.Centrifuge { | |
grpc_pass grpc://localhost:8001; | |
} | |
location /connection/websocket { | |
proxy_pass http://localhost:8000; | |
proxy_http_version 1.1; | |
proxy_set_header Upgrade $http_upgrade; | |
proxy_set_header Connection $connection_upgrade; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment