From 7228997186531f7c169764853ee28f4e1f47e63c Mon Sep 17 00:00:00 2001 From: samatrhea Date: Thu, 22 Feb 2024 17:09:41 +0100 Subject: [PATCH] [Add] nginx config to include improvements for server side hosting and adding no-caching --- COMETwebapp.sln | 1 + nginx | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 nginx diff --git a/COMETwebapp.sln b/COMETwebapp.sln index 789e8065..4badd57d 100644 --- a/COMETwebapp.sln +++ b/COMETwebapp.sln @@ -19,6 +19,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution CODE_OF_CONDUCT.md = CODE_OF_CONDUCT.md LICENSE = LICENSE LICENSE-APACHE 2.0 = LICENSE-APACHE 2.0 + nginx = nginx NOTICE = NOTICE Nuget.Config = Nuget.Config README.md = README.md diff --git a/nginx b/nginx new file mode 100644 index 00000000..f7b76c41 --- /dev/null +++ b/nginx @@ -0,0 +1,34 @@ +map $http_connection $connection_upgrade { + "~*Upgrade" $http_connection; + default keep-alive; +} + +server { + server_name comet-web.cdp4.org; + + location / { + proxy_pass http://127.0.0.1:8086; + + # Configuration for WebSockets + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; + proxy_cache off; + + # WebSockets were implemented after http/1.0 + proxy_http_version 1.1; + + # Configuration for LongPolling or if your KeepAliveInterval is longer than 60 seconds + proxy_read_timeout 100s; + + proxy_set_header Host $host; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + # kill cache + add_header Last-Modified $date_gmt; + add_header Cache-Control 'no-store, no-cache, must-revalidate, proxy-revalidate, max-age=0'; + if_modified_since off; + expires off; + etag off; + } +} \ No newline at end of file