# Public-facing push notification proxy # This runs on port 443 with SSL and ONLY exposes push endpoints server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name push.srv1002428.hstgr.cloud; # Or use a real domain # SSL configuration (you'll need to set up Let's Encrypt) ssl_certificate /etc/nginx/ssl/cert.pem; ssl_certificate_key /etc/nginx/ssl/key.pem; # Security headers add_header X-Frame-Options "SAMEORIGIN" always; add_header X-Content-Type-Options "nosniff" always; add_header X-XSS-Protection "1; mode=block" always; # CORS headers for push notifications add_header 'Access-Control-Allow-Origin' 'https://admin.dark.side' always; add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always; add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization' always; add_header 'Access-Control-Allow-Credentials' 'true' always; # Only allow specific push-related endpoints location ~ ^/(api/push|service-worker\.js|manifest\.json) { proxy_pass http://localhost:5100; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } # Block everything else location / { return 403; } } # Redirect HTTP to HTTPS for push domain server { listen 80; listen [::]:80; server_name push.srv1002428.hstgr.cloud; return 301 https://$server_name$request_uri; }