Skip to content

Commit

Permalink
enable websocket communication
Browse files Browse the repository at this point in the history
extend the nginx example configuration file such that communication through WebSockets is automatically enabled
  • Loading branch information
sjanssen2 committed Feb 16, 2024
1 parent 58e15a4 commit 224e3e1
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions qiita_pet/nginx_example.conf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ http {
server localhost:21177;
}

# define variables for the actions that shall be taken for websocket handshake
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}

# listening to 8080 and redirecting to https
server {
listen 8080;
Expand Down Expand Up @@ -56,6 +62,19 @@ http {
alias /Users/username/qiita/qiita_db/support_files/test_data/;
}

# enables communiction through websockets.
# Currently, only endpoints /consumer/, /analysis/selected/socket/, and /study/list/socket/ use websockets
location ~ ^/(consumer|analysis/selected/socket|study/list/socket)/ {
proxy_pass $scheme://mainqiita;
proxy_set_header Host $http_host;
proxy_redirect http:// https://;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header X-Forwarded-Host $http_host;
}

location / {
proxy_pass $scheme://mainqiita;
proxy_redirect off;
Expand Down

0 comments on commit 224e3e1

Please sign in to comment.