configuring-tauri-http-headers

Configures HTTP security headers and CORS policies in Tauri v2 applications.

Updated Jun 7, 2026
One-click install
npx skills add https://github.com/dt418/better-shot-x --skill configuring-tauri-http-headers-dt418
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: configuring-tauri-http-headers
Source: https://github.com/dt418/better-shot-x/tree/main/.agents/skills/configuring-tauri-http-headers
Command: npx skills add https://github.com/dt418/better-shot-x --skill configuring-tauri-http-headers-dt418

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Tauri developers often struggle to correctly set HTTP security headers and CORS policies, since Tauri restricts configuration to a specific allowlist and headers only apply to production builds, leaving dev servers unconfigured. ## Core Features & Use Cases - Security Header Configuration: Set COOP, COEP, CORP, X-Content-Type-Options, and Permissions-Policy via app.security.headers in tauri.conf.json. - CORS Management: Configure Access-Control headers for restrictive production or permissive development scenarios. - Dev Server Parity: Mirror headers in Vite, Angular, Nuxt, Next.js, and Trunk dev server configs for consistent behavior. - Use Case: Enable SharedArrayBuffer in a Tauri app by setting Cross-Origin-Opener-Policy to same-origin and Cross-Origin-Embedder-Policy to require-corp in both tauri.conf.json and the Vite dev server. ## Quick Start Configure the security headers in my tauri.conf.json to enable SharedArrayBuffer and add matching headers to my Vite dev server.

Frequently Asked Questions about configuring-tauri-http-headers

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I configure HTTP security headers in a Tauri v2 app?

Set headers under app.security.headers in src-tauri/tauri.conf.json using string, array, or object values. Only headers on Tauri's allowlist are supported, and the feature requires Tauri v2.1.0 or later.

How to enable SharedArrayBuffer in Tauri?

SharedArrayBuffer requires cross-origin isolation: set Cross-Origin-Opener-Policy to same-origin and Cross-Origin-Embedder-Policy to require-corp together in app.security.headers. Both headers must be present for it to work.

Why are my Tauri headers not applied in development?

Headers in tauri.conf.json only apply to production builds, not dev servers. Configure equivalent headers in your framework's dev server, such as the server.headers option in vite.config.ts.

Which HTTP headers does Tauri allow in tauri.conf.json?

Tauri restricts configuration to an allowlist covering CORS headers, Cross-Origin-Opener/Embedder/Resource-Policy, X-Content-Type-Options, Permissions-Policy, Timing-Allow-Origin, and Service-Worker-Allowed. Content-Security-Policy is configured separately under app.security.csp.

How do I fix CORS errors with external APIs in Tauri?

Add the required Access-Control headers such as Access-Control-Allow-Methods and Access-Control-Allow-Headers in app.security.headers. Use Access-Control-Expose-Headers to make custom response headers visible to the webview.