Aegisify company logo

We're Here to Help

Resources & Help Center

Search our knowledge base, view documentation, or get support. Everything you need in one place.

What does “Require a JSON media type for REST requests with a body” do?

The option Require a JSON media type for REST requests with a body is in Aegisify WAF → API & Application → REST Protection (Pro). It applies after REST hardening is enabled.

What it checks

For a REST request that:

  • uses a method other than GET, HEAD, or OPTIONS, and
  • has a non-empty body,

the Content-Type header must contain application/json. If it is missing or different (for example application/x-www-form-urlencoded or multipart/form-data), the request is blocked with HTTP 403 and logged with the reason content_type.

Why it helps

  • Modern REST clients send JSON. Other body formats often indicate automated tools or attempts to slip past input parsers.
  • Browsers cannot send cross-site JSON requests without a CORS preflight, so requiring JSON makes some cross-site request forgery (CSRF) tricks harder.

What can break

  • File uploads through REST (for example media uploads) use multipart/form-data.
  • Some form plugins post URL-encoded data to REST routes.
  • Older integrations or webhooks may send form data.

If those exist, add their routes to the REST route allowlist or keep the logged-in bypass on so authenticated media uploads continue to work.

Good fit

This control suits headless and API-first sites where every legitimate client is known to send JSON.

Related: Require authentication for writes, Max REST body size.

2026-12-01T03:52:17+00:00January 12th, 2026||

Find this article interesting, please share.