Skip to contentView the source on GitHub

no-disabled-origin-check

Keep Astro's built-in CSRF origin check enabled.

Securitywarning by default Project auditrecommended audit

astro-doctor/no-disabled-origin-check

Why it matters

Astro checks the Origin header for on-demand rendered pages to help prevent cross-site request forgery. Setting security.checkOrigin to false removes that protection from form submissions and other state-changing requests unless the application supplies an equivalent defense.

See the difference

Incorrect

Origin checking disabled

typescriptIncorrect example
import { defineConfig } from 'astro/config'

export default defineConfig({
  security: {
    checkOrigin: false,
  },
})

Correct

Use Astro's secure default

typescriptCorrect example
import { defineConfig } from 'astro/config'

export default defineConfig({
  security: {
    checkOrigin: true,
  },
})

Configure this check

Project audits are configured in doctor.config.ts:

typescriptdoctor.config.ts
export default {
  rules: {
    'astro-doctor/no-disabled-origin-check': 'error',
  },
}

Use 'error', 'warn', or 'off'. The configuration guide covers presets and per-file overrides.

Keep exploring security

Browse every rule and project audit