# Security headers สำหรับ Cloudflare Pages
# ไฟล์นี้อยู่ใน public/ → Vite คัดลอกไป dist/ ตอน build → Cloudflare อ่านจากที่นั่น
#
# ทำไมต้องตั้งเป็น HTTP header ทั้งที่มี <meta> CSP อยู่แล้ว:
#   - frame-ancestors ใช้ใน <meta> ไม่ได้ เบราว์เซอร์เพิกเฉยและพ่น error
#   - HSTS / X-Content-Type-Options / Permissions-Policy ไม่มีรูปแบบ meta เลย
#   - header มาก่อน HTML ถูก parse จึงกันได้แม้ไฟล์ HTML ถูกแก้

/*
  Content-Security-Policy: default-src 'self'; script-src 'self' 'wasm-unsafe-eval' blob:; worker-src 'self' blob:; child-src 'self' blob:; style-src 'self' 'unsafe-inline'; font-src 'self' data:; img-src 'self' data: blob:; connect-src 'self' https://*.supabase.co wss://*.supabase.co https://cdn.jsdelivr.net https://api.pwnedpasswords.com https://api.github.com; object-src 'none'; frame-src 'none'; frame-ancestors 'none'; form-action 'none'; base-uri 'none'; upgrade-insecure-requests
  Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
  X-Content-Type-Options: nosniff
  X-Frame-Options: DENY
  Referrer-Policy: no-referrer
  Permissions-Policy: camera=(), microphone=(), geolocation=(), payment=(), usb=(), interest-cohort=()
  Cross-Origin-Opener-Policy: same-origin
  Cross-Origin-Resource-Policy: same-origin
  X-DNS-Prefetch-Control: off

# ไฟล์ asset มี hash ในชื่ออยู่แล้ว (index-CZJTm3sg.js) เปลี่ยนเนื้อ = เปลี่ยนชื่อ
# จึง cache ยาวได้เต็มที่โดยไม่ต้องกลัวผู้ใช้ค้างเวอร์ชันเก่า
/assets/*
  Cache-Control: public, max-age=31536000, immutable

# ตัว HTML ห้าม cache ไม่งั้นผู้ใช้จะยังชี้ไป asset เวอร์ชันเก่าหลัง deploy
/index.html
  Cache-Control: public, max-age=0, must-revalidate

# ไฟล์บอกรหัส build — แอปดึงเพื่อเช็คว่ามีเวอร์ชันใหม่ ห้าม cache
/version.json
  Cache-Control: no-store
