{"id":1654,"date":"2020-06-07T22:42:55","date_gmt":"2020-06-07T14:42:55","guid":{"rendered":"https:\/\/www.wesbytes.com\/guide\/?post_type=kb&#038;p=1654"},"modified":"2026-03-26T12:56:36","modified_gmt":"2026-03-26T04:56:36","slug":"dynamic-content-chunked-encoding","status":"publish","type":"kb","link":"https:\/\/www.servergigabit.com\/guide\/kb\/dynamic-content-chunked-encoding","title":{"rendered":"chunked encoding: Why is my dynamic content being sent"},"content":{"rendered":"<h3><img fetchpriority=\"high\" decoding=\"async\" class=\"alignnone\" src=\"https:\/\/bunnyacademy.b-cdn.net\/6xdc9-What-Is-HTTP-Chunked-Encoding-How-and-When-Is-It-Used.png\" alt=\"What Is HTTP Chunked Encoding? How Is It Used?\" width=\"1919\" height=\"452\" \/><\/h3>\n<h3>Why is my dynamic content being sent with chunked encoding?<\/h3>\n<p>If you have resources that do not have a file extension that Cloudflare caches we treat that resource as dynamic HTML. We don\u2019t cache it by default, and Cloudflare\u2019s system will send that resource zipped and with chunked encoding.<\/p>\n<p><strong>Note<\/strong>\u00a0\u2014 it isn\u2019t possible to have chunk encoding and content-length at the same time so this would explain why content-length would not be sent with these dynamic resource passing through Cloudflare.<\/p>\n<p><strong>Note \u2014\u00a0<\/strong>Another reason you would not see a content-length header would be if you are sending HTTP 1.1 from your web server. For version 1.1 of the HTTP protocol, the chunked transfer mechanism is consider to be always acceptable. Even if not list in the TE request header field, and when use with other transfer mechanisms, should always be apply last to the transferred data and never more than one time. (Source:\u00a0<a title=\"wikipedia &quot;Chunked Encoding&quot;\" href=\"https:\/\/en.wikipedia.org\/wiki\/Chunked_transfer_encoding\" target=\"_blank\" rel=\"nofollow noopener noreferrer\">wikipedia \u201cChunked Encoding\u201d<\/a>).\u00a0 In this case you need to make sure\u00a0 is sending HTTP 1.0 as the protocol from your web server. If you specifically need the content-length header.<\/p>\n<p><strong>The solution \/ workaround<\/strong>\u00a0\u2013 If you add a file extension to the resource so that it matches our list of supported file extensions. So\u00a0<strong>example.com\/test\/dynamicallyimage.php?<\/strong>size=3\u00a0becomes<strong>\u00a0example.com\/dynamicallyimage.jpg .<\/strong>\u00a0Cloudflare\u2019s system will send it with the content-length header. As long as you\u2019re also sending HTTP 1.0 as the protocol.<\/p>\n<p>Alternatively you could use a PageRule and use the \u201ccustom caching\u201d option to select \u201ccache everything\u201d. After that, it will force our system to cache\u00a0<strong>example.com\/test\/dynamicallyimage.php?<\/strong>size=3. Even though it doesn\u2019t have one of our usual file extensions \u2014 in this case the content-length will also be preserved.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Why is my dynamic content being sent with chunked encoding? If you have resources that do not have a file extension that Cloudflare caches we treat that resource as dynamic HTML. We don\u2019t cache it by default, and Cloudflare\u2019s system will send that resource zipped and with chunked encoding. Note\u00a0\u2014 it isn\u2019t possible to have chunk encoding and content-length at&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"kbtopic":[43],"kbtag":[1399,1400],"class_list":["post-1654","kb","type-kb","status-publish","hentry","kbtopic-cloudflare","kbtag-chunked-encoding","kbtag-http"],"_links":{"self":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb\/1654","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb"}],"about":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/types\/kb"}],"author":[{"embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/comments?post=1654"}],"version-history":[{"count":5,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb\/1654\/revisions"}],"predecessor-version":[{"id":6408,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kb\/1654\/revisions\/6408"}],"wp:attachment":[{"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/media?parent=1654"}],"wp:term":[{"taxonomy":"kbtopic","embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kbtopic?post=1654"},{"taxonomy":"kbtag","embeddable":true,"href":"https:\/\/www.servergigabit.com\/guide\/wp-json\/wp\/v2\/kbtag?post=1654"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}