Files
boc/quixzoom-sso-auth/nginx.conf
T

68 lines
2.3 KiB
Nginx Configuration File
Raw Normal View History

# quiXzoom SSO - Nginx Configuration
# Place this in /etc/nginx/conf.d/quixzoom-sso.conf
upstream quixzoom_sso {
server localhost:8080;
keepalive 32;
}
# SSO Auth Service
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name auth.quixzoom.com;
# SSL certificates (Let's Encrypt or similar)
ssl_certificate /etc/letsencrypt/live/quixzoom.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/quixzoom.com/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
# 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;
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
# CORS for all quixzoom domains
location / {
# Preflight
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' $http_origin always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'Authorization, Content-Type, X-Requested-With' always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Max-Age' 1728000 always;
add_header 'Content-Type' 'text/plain; charset=utf-8' always;
add_header 'Content-Length' 0 always;
return 204;
}
# Actual requests
add_header 'Access-Control-Allow-Origin' $http_origin always;
add_header 'Access-Control-Allow-Credentials' 'true' always;
add_header 'Access-Control-Expose-Headers' 'Authorization' always;
proxy_pass http://quixzoom_sso;
proxy_http_version 1.1;
proxy_set_header Host $host;
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;
proxy_set_header Connection "";
# Cookie handling
proxy_cookie_domain localhost .quixzoom.com;
proxy_cookie_path / /;
}
}
# Redirect HTTP to HTTPS
server {
listen 80;
listen [::]:80;
server_name auth.quixzoom.com;
return 301 https://$server_name$request_uri;
}