From f24d0d7b702bfd190e1121b303385fbe1a81d400 Mon Sep 17 00:00:00 2001 From: Raine Date: Fri, 20 Oct 2023 07:29:19 +0200 Subject: [PATCH] using ntfy's nginx config --- .../custom/nginx/conf.d/ntfy.conf | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/servers/link/docker-compose.d/custom/nginx/conf.d/ntfy.conf b/servers/link/docker-compose.d/custom/nginx/conf.d/ntfy.conf index 13b7049..db105b4 100644 --- a/servers/link/docker-compose.d/custom/nginx/conf.d/ntfy.conf +++ b/servers/link/docker-compose.d/custom/nginx/conf.d/ntfy.conf @@ -3,6 +3,36 @@ server { server_name push.ixvd.net; location / { + # Redirect HTTP to HTTPS, but only for GET topic addresses, since we want + # it to work with curl without the annoying https:// prefix + set $redirect_https ""; + if ($request_method = GET) { + set $redirect_https "yes"; + } + if ($request_uri ~* "^/([-_a-z0-9]{0,64}$|docs/|static/)") { + set $redirect_https "${redirect_https}yes"; + } + if ($redirect_https = "yesyes") { + return 302 https://$http_host$request_uri$is_args$query_string; + } + proxy_pass http://ntfy$request_uri; + proxy_http_version 1.1; + + proxy_buffering off; + proxy_request_buffering off; + proxy_redirect off; + + proxy_set_header Host $http_host; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + + proxy_connect_timeout 3m; + proxy_send_timeout 3m; + proxy_read_timeout 3m; + + client_max_body_size 0; # Stream request body to backend + } } \ No newline at end of file