Cloudflare Docs
Rules
Rules
Edit this page on GitHub
Set theme to dark (⇧+D)

Custom error responses

Beta

Custom error responses, powered by the Ruleset Engine, allow you to define custom responses for errors returned by an origin server or by a Cloudflare product (including Workers). Custom error responses will apply to responses whose HTTP status code is greater than or equal to 400 that match the expression of the custom error response rule.

To configure a custom error response, create a custom error response rule at the zone level. Custom error response rules will override Custom Pages at the zone or account level.

​​ How it works

When a custom error response is triggered, Cloudflare will replace the body and (optionally) the HTTP status code of the response sent to the visitor. Cloudflare will keep any existing HTTP response headers except for Content-Type and Content-Length.

Additionally, you can configure HTTP response header modification rules for error responses to add, change, or remove HTTP headers from the error response.

​​ Availability

Custom error responses are available in beta to all paid plans. The exact features depend on your Cloudflare plan:

FreeProBusinessEnterprise
Custom error responsesNoYesYesYes
Number of custom error response rules52050