using ntfy's nginx config

This commit is contained in:
Strix 2023-10-20 07:29:19 +02:00
parent 29e1ccf861
commit f24d0d7b70
No known key found for this signature in database
GPG key ID: 49B2E37B8915B774

View file

@ -3,6 +3,36 @@ server {
server_name push.ixvd.net; server_name push.ixvd.net;
location / { 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_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
} }
} }