From 0b9237bf209f00ca6c79b4578233741078e65ff1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Go=CC=88khan=20S=CC=A7engu=CC=88n?= Date: Tue, 7 Jun 2022 20:08:23 +0300 Subject: [PATCH] Fix signalr proxying over nginx --- etc/docker/docker-compose.yml | 5 ++-- etc/docker/nginx/conf.d/default.conf | 34 +++++++++++++--------------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/etc/docker/docker-compose.yml b/etc/docker/docker-compose.yml index d8595046..402d38f5 100644 --- a/etc/docker/docker-compose.yml +++ b/etc/docker/docker-compose.yml @@ -22,7 +22,8 @@ services: - eshop-st-web - eshop-st-public-web - eshop-st-gateway-web-public - - eshop-st-gateway-web + - eshop-st-gateway-web + restart: on-failure networks: - eshoponabp-network @@ -245,7 +246,7 @@ services: context: ../../ dockerfile: apps/angular/Dockerfile volumes: - - ./nginx/dynamic-env.json://usr/share/nginx/html/dynamic-env.json + - ./nginx/dynamic-env.json:/usr/share/nginx/html/dynamic-env.json depends_on: redis: condition: service_healthy diff --git a/etc/docker/nginx/conf.d/default.conf b/etc/docker/nginx/conf.d/default.conf index 13dc3554..868da3a6 100644 --- a/etc/docker/nginx/conf.d/default.conf +++ b/etc/docker/nginx/conf.d/default.conf @@ -3,11 +3,6 @@ server { server_name eshop-st-administration; return 301 https://$host$request_uri; - - location / { - proxy_pass http://eshop-st-administration:80; - proxy_set_header Host $host; - } } server { listen 443 ssl; @@ -124,11 +119,26 @@ server { location / { proxy_pass http://eshop-st-public-web:80; + proxy_set_header Host $host; proxy_buffer_size 128k; proxy_buffers 4 256k; proxy_busy_buffers_size 256k; + + } + + location /signalr-hubs { + proxy_pass http://eshop-st-public-web:80; + + proxy_set_header Host $host; + + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_cache_bypass $http_upgrade; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; } } server { @@ -236,16 +246,6 @@ server { server_name eshop-st-gateway-web-public; return 301 https://$host$request_uri; - - location / { - proxy_pass http://eshop-st-gateway-web-public:80; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection keep-alive; - proxy_set_header Host $host; - proxy_cache_bypass $http_upgrade; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; - } } server { listen 443 ssl; @@ -258,10 +258,8 @@ server { location / { proxy_pass http://eshop-st-gateway-web-public:80; - proxy_set_header Upgrade $http_upgrade; - proxy_set_header Connection keep-alive; proxy_set_header Host $host; - proxy_cache_bypass $http_upgrade; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; }