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 {