Compatibility flags·续8
HTML5 does not recognize XML self-closing tag syntax. For example,
<script src="foo.js" />does not specify a script element with no body. A</script>ending tag is still required. The/>syntax simply is not recognized by HTML5 at all and it is treated the same as>. However, many developers still like to use this syntax, as a holdover from XHTML, a standard which failed to gain traction in the early 2000's.
<esi:include>and<esi:comment>are two tags that are not part of the HTML5 standard, but are instead used as part of Edge Side Includes ↗︎, a technology for server-side HTML modification. These tags are not expected to contain any body and are commonly written with XML self-closing syntax.
HTMLRewriterwas designed to parse standard HTML5, not ESI. However, it would be useful to be able to implement some parts of ESI usingHTMLRewriter. To that end, this compatibility flag causesHTMLRewriterto treat<esi:include>and<esi:comment>as void tags, so that they can be parsed and handled properly.Experimental flags
These flags can be enabled via
compatibility_flags, but are not yet scheduled to become default on any particular date.Queue consumers don't wait for
ctx.waitUntil()to resolve
Flag to enable queue_consumer_no_wait_for_wait_untilBy default, Queues Consumer Workers acknowledge messages only after promises passed to
ctx.waitUntil()have resolved. This behavior can cause queue consumers which utilizectx.waitUntil()to process messages slowly. The default behavior is documented in the Queues Consumer Configuration Guide.This Consumer Worker is an example of a Worker which utilizes
ctx.waitUntil(). Under the default behavior, this consumer Worker will only acknowledge a batch of messages after the sleep function has resolved.
export default {
async fetch(request, env, ctx) {
// omitted
},
async queue(batch, env, ctx) {
console.log(`received batch of ${batch.messages.length} messages to queue ${batch.queue}`);
for (let i = 0; i < batch.messages.length; ++i) {
console.log(`message #${i}: ${JSON.stringify(batch.messages[i])}`);
}
ctx.waitUntil(sleep(30 * 1000));
}
};
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}
If the
queue_consumer_no_wait_for_wait_untilflag is enabled, Queues consumers will no longer wait for promises passed toctx.waitUntil()to resolve before acknowledging messages. This can improve the performance of queue consumers which utilizectx.waitUntil(). With the flag enabled, in the above example, the consumer Worker will acknowledge the batch without waiting for the sleep function to resolve.Using this flag will not affect the behavior of
ctx.waitUntil().ctx.waitUntil()will continue to extend the lifetime of your consumer Worker to continue to work even after the batch of messages has been acknowledged.
HTMLRewriterhandling of<esi:include>
Flag to enable html_rewriter_treats_esi_include_as_void_tagThe HTML5 standard defines a fixed set of elements as void elements, meaning they do not use an end tag:
<area>,<base>,<br>,<col>,<command>,<embed>,<hr>,<img>,<input>,<keygen>,<link>,<meta>,<param>,<source>,<track>, and<wbr>.HTML5 does not recognize XML self-closing tag syntax. For example,
<script src="foo.js" />does not specify a script element with no body. A</script>ending tag is still required. The/>syntax simply is not recognized by HTML5 at all and it is treated the same as>. However, many developers still like to use this syntax, as a holdover from XHTML, a standard which failed to gain traction in the early 2000's.
<esi:include>and<esi:comment>are two tags that are not part of the HTML5 standard, but are instead used as part of Edge Side Includes ↗︎, a technology for server-side HTML modification. These tags are not expected to contain any body and are commonly written with XML self-closing syntax.
HTMLRewriterwas designed to parse standard HTML5, not ESI. However, it would be useful to be able to implement some parts of ESI usingHTMLRewriter. To that end, this compatibility flag causesHTMLRewriterto treat<esi:include>and<esi:comment>as void tags, so that they can be parsed and handled properly.Was this helpful?
YesNo
On this page
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/workers/configuration/compatibility-flags/#page","headline":"Compatibility flags","description":"Opt into a specific features of the Workers runtime for your Workers project.","url":"https://developers.cloudflare.com/workers/configuration/compatibility-flags/","inLanguage":"en","image":"https://developers.cloudflare.com/workers/configuration/compatibility-flags/og.png?v=50d3a56287b2d518","dateModified":"2026-09-18","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
description: Enable your Worker to be executed on a schedule. title: Cron Triggers image: https://developers.cloudflare.com/workers/configuration/cron-triggers/og.png?v=b85b0c1fb54550ff
Documentation Index
Fetch the complete documentation index at: https://developers.cloudflare.com/workers/llms.txt
Use this file to discover all available pages before exploring further.
Docs