nginx icon indicating copy to clipboard operation
nginx copied to clipboard

proxy support websocket?

Open crapthings opened this issue 6 years ago • 3 comments

crapthings avatar Mar 21 '18 02:03 crapthings

Example or use case?

blacklabelops avatar Mar 21 '18 06:03 blacklabelops

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

crapthings avatar Mar 21 '18 07:03 crapthings

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

blacklabelops avatar Mar 21 '18 08:03 blacklabelops