blacklabelops-legacy / nginx

Dockerized Ready-To-Go Nginx Reverse Proxy. Let's encrypt Support!
MIT License
95 stars 41 forks source link

proxy support websocket? #40

Open crapthings opened 6 years ago

blacklabelops commented 6 years ago

Example or use case?

crapthings commented 6 years ago

https://medium.com/startup-founder-panel/deploying-a-meteor-app-with-nginx-from-scratch-1332b32e99a5

blacklabelops commented 6 years ago

I would suggest a new environment variable SERVERXREVERSE_PROXY_WEBSOCKETY with values true or false. false default.

For adding the following elements to a proxy definition:

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade; #for websockets
proxy_set_header Connection $connection_upgrade;

Should work like this

$ docker run -d \
    -p 80:80 \
    --name nginx \
    -e "SERVER1REVERSE_PROXY_LOCATION1=/" \
    -e "SERVER1REVERSE_PROXY_PASS1=http://www.heise.de/" \
    -e "SERVER1REVERSE_PROXY_LOCATION2=/alternate" \
    -e "SERVER1REVERSE_PROXY_PASS2=http://www.alternate.de/" \
    -e "SERVER1REVERSE_PROXY_WEBSOCKET2=true" \
    blacklabelops/nginx