Skip to main content
kitlocal.dev

CORS Header Generator

Runs locally

100% processed in your browser. Inputs and outputs never leave your device.

Generate CORS configuration for common web servers and frameworks

Access-Control-Allow-Methods
Comma-separated response headers exposed to client JavaScript.
Preflight cache duration in seconds (default 86400).
HTTP Response Headers
Nginx Location Snippet
location /api/ {
    if ($request_method = 'OPTIONS') {
        add_header 'Access-Control-Allow-Origin' 'https://example.com';
        add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
        add_header 'Access-Control-Allow-Headers' 'Content-Type, Authorization';
        add_header 'Access-Control-Max-Age' 86400;
        add_header 'Content-Type' 'text/plain; charset=UTF-8';
        add_header 'Content-Length' 0;
        return 204;
    }

    add_header 'Access-Control-Allow-Origin' 'https://example.com' always;
    add_header 'Access-Control-Allow-Credentials' 'true' always;
}