# Include this file from OpenResty's http block. The Compose service listens only # on 127.0.0.1:18080, so clients cannot bypass these controls. map $http_upgrade $connection_upgrade { default upgrade; '' close; } limit_req_zone $binary_remote_addr zone=account_api:10m rate=20r/s; limit_req_zone $binary_remote_addr zone=invite_page:10m rate=5r/s; limit_req_status 429; upstream osg_account_server { server 127.0.0.1:18080; keepalive 32; } server { listen 80; listen [::]:80; server_name account.osglab.com; return 308 https://$host$request_uri; } server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name account.osglab.com; ssl_certificate /www/server/panel/vhost/cert/account.osglab.com/fullchain.pem; ssl_certificate_key /www/server/panel/vhost/cert/account.osglab.com/privkey.pem; ssl_protocols TLSv1.2 TLSv1.3; ssl_session_timeout 1d; ssl_session_cache shared:account_tls:10m; client_max_body_size 21m; server_tokens off; add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; add_header X-Content-Type-Options "nosniff" always; add_header X-Frame-Options "DENY" always; add_header Referrer-Policy "no-referrer" always; # Never publish operational or administrative paths through this vhost. location ~ ^/(?:admin|internal|v1/admin)(?:/|$) { return 404; } location / { limit_req zone=account_api burst=40 nodelay; proxy_pass http://osg_account_server; 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 https; proxy_set_header X-Request-ID $request_id; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_hide_header Server; proxy_request_buffering off; proxy_buffering off; proxy_cache off; proxy_read_timeout 360s; proxy_send_timeout 360s; } } server { listen 80; listen [::]:80; server_name osglab.com www.osglab.com; return 308 https://osglab.com$request_uri; } server { listen 443 ssl http2; listen [::]:443 ssl http2; server_name osglab.com www.osglab.com; ssl_certificate /www/server/panel/vhost/cert/osglab.com/fullchain.pem; ssl_certificate_key /www/server/panel/vhost/cert/osglab.com/privkey.pem; ssl_protocols TLSv1.2 TLSv1.3; server_tokens off; add_header Strict-Transport-Security "max-age=31536000; includeSubDomains" always; add_header X-Content-Type-Options "nosniff" always; add_header Referrer-Policy "no-referrer" always; location = /.well-known/apple-app-site-association { access_log off; proxy_pass http://osg_account_server; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto https; } location = /apple-app-site-association { access_log off; proxy_pass http://osg_account_server; proxy_set_header Host $host; proxy_set_header X-Forwarded-Proto https; } # Invitation codes are bearer-like values and must not appear in access logs. location ^~ /i/ { access_log off; limit_req zone=invite_page burst=10 nodelay; proxy_pass http://osg_account_server; 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 https; proxy_set_header X-Request-ID $request_id; proxy_hide_header Server; proxy_buffering off; proxy_cache off; } # Keep the existing 1Panel site root for all non-invitation pages. root /www/wwwroot/osglab.com; location / { try_files $uri $uri/ =404; } }