mirror of
				https://github.com/9technologygroup/patchmon.net.git
				synced 2025-10-31 03:53:51 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			68 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			68 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| server {
 | |
|     listen 3000;
 | |
|     server_name localhost;
 | |
|     root /usr/share/nginx/html;
 | |
|     index index.html;
 | |
| 
 | |
|     tcp_nopush on;
 | |
|     gzip on;
 | |
|     gzip_vary on;
 | |
|     gzip_min_length 1024;
 | |
|     gzip_types
 | |
|         text/plain
 | |
|         text/css
 | |
|         text/xml
 | |
|         text/javascript
 | |
|         application/javascript
 | |
|         application/xml+rss
 | |
|         application/json
 | |
|         application/xml;
 | |
| 
 | |
|     # Security headers
 | |
|     add_header X-Frame-Options DENY 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;
 | |
| 
 | |
|     # Handle client-side routing
 | |
|     location / {
 | |
|         try_files $uri $uri/ /index.html;
 | |
|     }
 | |
| 
 | |
|     # API proxy
 | |
|     location /api/ {
 | |
|         proxy_pass http://${BACKEND_HOST}:${BACKEND_PORT};
 | |
|         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 X-Forwarded-Host $host;
 | |
| 
 | |
|         # Preserve original client IP through proxy chain
 | |
|         proxy_set_header X-Original-Forwarded-For $http_x_forwarded_for;
 | |
| 
 | |
|         # CORS headers for API calls
 | |
|         add_header Access-Control-Allow-Origin * always;
 | |
|         add_header Access-Control-Allow-Methods "GET, POST, PUT, DELETE, OPTIONS" always;
 | |
|         add_header Access-Control-Allow-Headers "DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization" always;
 | |
| 
 | |
|         # Handle preflight requests
 | |
|         if ($request_method = 'OPTIONS') {
 | |
|             return 204;
 | |
|         }
 | |
|     }
 | |
| 
 | |
|     # Static assets caching
 | |
|     location ~* \.(js|css|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ {
 | |
|         expires 1y;
 | |
|         add_header Cache-Control "public, immutable";
 | |
|     }
 | |
| 
 | |
|     # Health check endpoint
 | |
|     location /health {
 | |
|         access_log off;
 | |
|         return 200 "healthy\n";
 | |
|         add_header Content-Type text/plain;
 | |
|     }
 | |
| }
 |