server {
    listen 80;
    listen [::]:80;
    server_name  localhost;

    root /static;

    location /videos/ {
        mp4;
        mp4_buffer_size     1m;
        mp4_max_buffer_size 5m; 
    }

    location / {
        # Add CORS headers
        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
        add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';

        # Optional: Customize the Access-Control-Expose-Headers header
        add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range';

        # Optional: Customize the Access-Control-Max-Age header (pre-flight requests caching time)
        add_header 'Access-Control-Max-Age' 1728000;
    }    
}