From 63d518ebcea85b7d489696b5422a6d9ae0e3d0c9 Mon Sep 17 00:00:00 2001 From: Roberto Alsina Date: Tue, 30 Apr 2024 13:45:59 -0300 Subject: [PATCH] Gotify (working) --- README.md | 2 +- nginx.conf | 23 +++++++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index aafc80c..84d817d 100644 --- a/README.md +++ b/README.md @@ -10,5 +10,5 @@ When adding a new hostname, remember to create a cert for it using Every 90 days the tailscale auth key will expire and you need to set a new one as a secret. -* Create the new one at https://login.tailscale.com/admin/settings/keys +* Create the new one at https://login.tailscale.com/admin/settings/keys (MAKE IT REUSABLE) * Configure it using flyctl secrets set TAILSCALE_AUTHKEY={{PASTEKEYHERE}} diff --git a/nginx.conf b/nginx.conf index 121c75b..8f247cd 100644 --- a/nginx.conf +++ b/nginx.conf @@ -37,11 +37,34 @@ server { listen [::]:8080; server_name gotify.ralsina.me; + + add_header 'Access-Control-Allow-Origin' '*'; + add_header 'Access-Control-Allow-Headers' '*'; + add_header 'Access-Control-Allow-Credentials' 'true'; + add_header 'Allow' 'POST, GET, OPTIONS'; + + if ($request_method = 'OPTIONS' ) { + return 200; + } location / { proxy_pass http://pinky.ralsina.github.beta.tailscale.net:7777; proxy_set_header X-Forwarded-Host $http_host; } + + location /stream { + proxy_pass http://pinky.ralsina.github.beta.tailscale.net:7777; + proxy_set_header Host $host; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "Upgrade"; + } + + error_page 403 404 500 502 503 504 /custom_50x.html; + location = /custom_50x.html { + root /usr/share/nginx/html; + internal; + } } server {