Add a new location for the websocket.

This commit is contained in:
Andrea Dell'Amico 2022-04-29 18:40:15 +02:00
parent 340f546997
commit 63adf53d2a
Signed by: andrea.dellamico
GPG Key ID: 147ABE6CEB9E20FF
1 changed files with 18 additions and 18 deletions

View File

@ -4,13 +4,6 @@ js_var $pep_credentials;
js_var $remote_user_js;
underscores_in_headers on;
{% if inception_project_websockets_enabled == 'true' %}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
{% endif %}
upstream _inception-server {
ip_hash;
server {{ inception_project_docker_service_name }}:{{ inception_project_server_port }};
@ -26,11 +19,6 @@ server {
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log{% if nginx_pep_debug_enabled %} debug{% endif %};
{% if inception_project_websockets_enabled == 'true' %}
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
{% endif %}
{% if inception_project_pep_allow_iframe %}
proxy_hide_header X-Frame-Options;
add_header X-Frame-Options "";
@ -42,18 +30,30 @@ server {
client_max_body_size {{ nginx_pep_max_body_size }};
client_body_timeout {{ nginx_pep_body_timeout }};
{% if inception_project_websockets_enabled == 'true' %}
location /inception/ws {
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_set_header Authorization "Bearer $auth_token";
proxy_set_header remote_user "$remote_user_js";
proxy_pass http://_inception-server;
}
{% endif %}
location / {
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Connection ""; # Clear for keepalive
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $host;
proxy_set_header nginx-request-uri $request_uri;
proxy_set_header X-Original-URI $request_uri;
proxy_max_temp_file_size 0;
proxy_connect_timeout 180;
proxy_send_timeout 180;
proxy_read_timeout 180;
proxy_temp_file_write_size 64k;
proxy_set_header Authorization "Bearer $auth_token";
proxy_set_header remote_user "$remote_user_js";
proxy_pass http://_inception-server;