# Example nginx configuration for the application
# This should be customized based on specific requirements

events {
    worker_connections 1024;
}

http {
    upstream app_server {
        # Connect to the gunicorn server
        server app:21000;
    }

    server {
        listen 80;
        server_name localhost;

        # Handle health check endpoint
        location /health {
            access_log off;
            proxy_pass http://app_server;
        }

        # Main application
        location / {
            proxy_pass http://app_server;
            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;
            
            # Security headers
            add_header X-Frame-Options "SAMEORIGIN" always;
            add_header X-XSS-Protection "1; mode=block" always;
            add_header X-Content-Type-Options "nosniff" always;
            add_header Referrer-Policy "no-referrer-when-downgrade" always;
            add_header Content-Security-Policy "default-src 'self' http: https: data: blob: 'unsafe-inline'" always;
        }
    }
}