{"id":7042,"date":"2014-10-31T06:20:57","date_gmt":"2014-10-31T05:20:57","guid":{"rendered":"https:\/\/anexia.com\/stagingblog\/?p=7042"},"modified":"2022-04-22T12:19:32","modified_gmt":"2022-04-22T10:19:32","slug":"the-tale-of-lighttpd-not-sending-the-last-modified-header","status":"publish","type":"post","link":"https:\/\/anexia.com\/blog\/en\/the-tale-of-lighttpd-not-sending-the-last-modified-header\/","title":{"rendered":"The tale of lighttpd not sending the Last-Modified header"},"content":{"rendered":"<p>Yesterday, whilst testing our new public Debian Mirror (<a title=\"debian.anexia.at\" href=\"http:\/\/debian.anexia.at\/\" target=\"_blank\" rel=\"noopener\">http:\/\/debian.anexia.at\/<\/a>) I noticed that my system would re-download the <em>Packages.gz<\/em> files every time I did an <em>apt-get update.<\/em><\/p>\n<p>Now that&#8217;s not what you expect and my first impression that a configuration issue on our side is causing this behaviour was right.<\/p>\n<p>As the title of this entry already suggests, the reason for apt-get always re-downloading the package list was a missing Last-Modified header on the server&#8217;s end.<\/p>\n<p><!--more--><\/p>\n<p>After quite a while of debugging without finding any real results I fetched the lighttpd source code (using apt-get source lighttpd &#8211; which got me version 1.4.31-4) and started digging.<\/p>\n<p>5 minutes later I found an interesting piece of code in mod_staticfile.c of lighttpd 1.4.31 , line 449.<\/p>\n<p>Without quoting the code itself, the short version of what&#8217;s there is the following: if the Content-Type is NULL, then set the Content-Type to &#8222;application\/octet-stream&#8220; and <strong>disable caching<\/strong>.<\/p>\n<p>In this case disabling caching means that both ETag and Last-Modified are neither calculated, nor sent with the response.<\/p>\n<p>But how to fix that? There were multiple approaches as lighttpd processes <em>\/etc\/mime.types<\/em> on Debian. One solution that works for each and every file is defining a fall-back value inside the configuration file.<\/p>\n<p>Why? Because the Content-Type will not be NULL when it reaches the check.<\/p>\n<p>tl;dr:<\/p>\n<p>Long story short, the fix was adding these three lines to the bottom of our <em>lighttpd.conf<\/em>:<\/p>\n<blockquote><p>mimetype.assign += (<\/p>\n<p>&#8222;&#8220; =&gt; &#8222;application\/octet-stream&#8220;<\/p>\n<p>)<\/p><\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>As the title already suggests, the reason for apt-get always re-downloading the package list was a missing Last-Modified header on the server&#8217;s end.<\/p>\n","protected":false},"author":5,"featured_media":205,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1129],"tags":[1957,1622,2165,1963],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>The tale of lighttpd not sending the Last-Modified header - ANEXIA Blog<\/title>\n<meta name=\"description\" content=\"As the title already suggests, the reason for apt-get always re-downloading the package list was a missing Last-Modified header on the server&#039;s end.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/anexia.com\/blog\/en\/the-tale-of-lighttpd-not-sending-the-last-modified-header\/\" \/>\n<meta property=\"og:locale\" content=\"de_DE\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The tale of lighttpd not sending the Last-Modified header - ANEXIA Blog\" \/>\n<meta property=\"og:description\" content=\"As the title already suggests, the reason for apt-get always re-downloading the package list was a missing Last-Modified header on the server&#039;s end.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/anexia.com\/blog\/en\/the-tale-of-lighttpd-not-sending-the-last-modified-header\/\" \/>\n<meta property=\"og:site_name\" content=\"ANEXIA Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/anexiagmbh\/\" \/>\n<meta property=\"article:published_time\" content=\"2014-10-31T05:20:57+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-04-22T10:19:32+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/anexia.com\/blog\/wp-content\/uploads\/2014\/10\/light_logo.png\" \/>\n\t<meta property=\"og:image:width\" content=\"249\" \/>\n\t<meta property=\"og:image:height\" content=\"239\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Stephan Peijnik\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@_ANEXIA\" \/>\n<meta name=\"twitter:site\" content=\"@_ANEXIA\" \/>\n<meta name=\"twitter:label1\" content=\"Verfasst von\" \/>\n\t<meta name=\"twitter:data1\" content=\"Stephan Peijnik\" \/>\n\t<meta name=\"twitter:label2\" content=\"Gesch\u00e4tzte Lesezeit\" \/>\n\t<meta name=\"twitter:data2\" content=\"1\u00a0Minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/anexia.com\/blog\/en\/the-tale-of-lighttpd-not-sending-the-last-modified-header\/\",\"url\":\"https:\/\/anexia.com\/blog\/en\/the-tale-of-lighttpd-not-sending-the-last-modified-header\/\",\"name\":\"The tale of lighttpd not sending the Last-Modified header - ANEXIA Blog\",\"isPartOf\":{\"@id\":\"https:\/\/anexia.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/anexia.com\/blog\/en\/the-tale-of-lighttpd-not-sending-the-last-modified-header\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/anexia.com\/blog\/en\/the-tale-of-lighttpd-not-sending-the-last-modified-header\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/anexia.com\/blog\/wp-content\/uploads\/2014\/10\/light_logo.png\",\"datePublished\":\"2014-10-31T05:20:57+00:00\",\"dateModified\":\"2022-04-22T10:19:32+00:00\",\"author\":{\"@id\":\"https:\/\/anexia.com\/blog\/#\/schema\/person\/8f95147348ae0ed7e4c25999bebf0f1d\"},\"description\":\"As the title already suggests, the reason for apt-get always re-downloading the package list was a missing Last-Modified header on the server's end.\",\"breadcrumb\":{\"@id\":\"https:\/\/anexia.com\/blog\/en\/the-tale-of-lighttpd-not-sending-the-last-modified-header\/#breadcrumb\"},\"inLanguage\":\"de\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/anexia.com\/blog\/en\/the-tale-of-lighttpd-not-sending-the-last-modified-header\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/anexia.com\/blog\/en\/the-tale-of-lighttpd-not-sending-the-last-modified-header\/#primaryimage\",\"url\":\"https:\/\/anexia.com\/blog\/wp-content\/uploads\/2014\/10\/light_logo.png\",\"contentUrl\":\"https:\/\/anexia.com\/blog\/wp-content\/uploads\/2014\/10\/light_logo.png\",\"width\":249,\"height\":239},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/anexia.com\/blog\/en\/the-tale-of-lighttpd-not-sending-the-last-modified-header\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/anexia.com\/blog\/de\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"The tale of lighttpd not sending the Last-Modified header\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/anexia.com\/blog\/#website\",\"url\":\"https:\/\/anexia.com\/blog\/\",\"name\":\"ANEXIA Blog\",\"description\":\"[:de] ANEXIA Blog - Technischen Themen, Anexia News und Insights [:]\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/anexia.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"de\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/anexia.com\/blog\/#\/schema\/person\/8f95147348ae0ed7e4c25999bebf0f1d\",\"name\":\"Stephan Peijnik\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"de\",\"@id\":\"https:\/\/anexia.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/0bfcb213a87f6c6c67ec494bc0ae5585?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/0bfcb213a87f6c6c67ec494bc0ae5585?s=96&d=mm&r=g\",\"caption\":\"Stephan Peijnik\"},\"url\":\"https:\/\/anexia.com\/blog\/author\/spe\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"The tale of lighttpd not sending the Last-Modified header - ANEXIA Blog","description":"As the title already suggests, the reason for apt-get always re-downloading the package list was a missing Last-Modified header on the server's end.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/anexia.com\/blog\/en\/the-tale-of-lighttpd-not-sending-the-last-modified-header\/","og_locale":"de_DE","og_type":"article","og_title":"The tale of lighttpd not sending the Last-Modified header - ANEXIA Blog","og_description":"As the title already suggests, the reason for apt-get always re-downloading the package list was a missing Last-Modified header on the server's end.","og_url":"https:\/\/anexia.com\/blog\/en\/the-tale-of-lighttpd-not-sending-the-last-modified-header\/","og_site_name":"ANEXIA Blog","article_publisher":"https:\/\/www.facebook.com\/anexiagmbh\/","article_published_time":"2014-10-31T05:20:57+00:00","article_modified_time":"2022-04-22T10:19:32+00:00","og_image":[{"width":249,"height":239,"url":"https:\/\/anexia.com\/blog\/wp-content\/uploads\/2014\/10\/light_logo.png","type":"image\/png"}],"author":"Stephan Peijnik","twitter_card":"summary_large_image","twitter_creator":"@_ANEXIA","twitter_site":"@_ANEXIA","twitter_misc":{"Verfasst von":"Stephan Peijnik","Gesch\u00e4tzte Lesezeit":"1\u00a0Minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/anexia.com\/blog\/en\/the-tale-of-lighttpd-not-sending-the-last-modified-header\/","url":"https:\/\/anexia.com\/blog\/en\/the-tale-of-lighttpd-not-sending-the-last-modified-header\/","name":"The tale of lighttpd not sending the Last-Modified header - ANEXIA Blog","isPartOf":{"@id":"https:\/\/anexia.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/anexia.com\/blog\/en\/the-tale-of-lighttpd-not-sending-the-last-modified-header\/#primaryimage"},"image":{"@id":"https:\/\/anexia.com\/blog\/en\/the-tale-of-lighttpd-not-sending-the-last-modified-header\/#primaryimage"},"thumbnailUrl":"https:\/\/anexia.com\/blog\/wp-content\/uploads\/2014\/10\/light_logo.png","datePublished":"2014-10-31T05:20:57+00:00","dateModified":"2022-04-22T10:19:32+00:00","author":{"@id":"https:\/\/anexia.com\/blog\/#\/schema\/person\/8f95147348ae0ed7e4c25999bebf0f1d"},"description":"As the title already suggests, the reason for apt-get always re-downloading the package list was a missing Last-Modified header on the server's end.","breadcrumb":{"@id":"https:\/\/anexia.com\/blog\/en\/the-tale-of-lighttpd-not-sending-the-last-modified-header\/#breadcrumb"},"inLanguage":"de","potentialAction":[{"@type":"ReadAction","target":["https:\/\/anexia.com\/blog\/en\/the-tale-of-lighttpd-not-sending-the-last-modified-header\/"]}]},{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/anexia.com\/blog\/en\/the-tale-of-lighttpd-not-sending-the-last-modified-header\/#primaryimage","url":"https:\/\/anexia.com\/blog\/wp-content\/uploads\/2014\/10\/light_logo.png","contentUrl":"https:\/\/anexia.com\/blog\/wp-content\/uploads\/2014\/10\/light_logo.png","width":249,"height":239},{"@type":"BreadcrumbList","@id":"https:\/\/anexia.com\/blog\/en\/the-tale-of-lighttpd-not-sending-the-last-modified-header\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/anexia.com\/blog\/de\/"},{"@type":"ListItem","position":2,"name":"The tale of lighttpd not sending the Last-Modified header"}]},{"@type":"WebSite","@id":"https:\/\/anexia.com\/blog\/#website","url":"https:\/\/anexia.com\/blog\/","name":"ANEXIA Blog","description":"[:de] ANEXIA Blog - Technischen Themen, Anexia News und Insights [:]","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/anexia.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"de"},{"@type":"Person","@id":"https:\/\/anexia.com\/blog\/#\/schema\/person\/8f95147348ae0ed7e4c25999bebf0f1d","name":"Stephan Peijnik","image":{"@type":"ImageObject","inLanguage":"de","@id":"https:\/\/anexia.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/0bfcb213a87f6c6c67ec494bc0ae5585?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0bfcb213a87f6c6c67ec494bc0ae5585?s=96&d=mm&r=g","caption":"Stephan Peijnik"},"url":"https:\/\/anexia.com\/blog\/author\/spe\/"}]}},"lang":"en","translations":{"en":7042,"de":182},"amp_enabled":true,"pll_sync_post":[],"_links":{"self":[{"href":"https:\/\/anexia.com\/blog\/wp-json\/wp\/v2\/posts\/7042"}],"collection":[{"href":"https:\/\/anexia.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/anexia.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/anexia.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/anexia.com\/blog\/wp-json\/wp\/v2\/comments?post=7042"}],"version-history":[{"count":3,"href":"https:\/\/anexia.com\/blog\/wp-json\/wp\/v2\/posts\/7042\/revisions"}],"predecessor-version":[{"id":7047,"href":"https:\/\/anexia.com\/blog\/wp-json\/wp\/v2\/posts\/7042\/revisions\/7047"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/anexia.com\/blog\/wp-json\/wp\/v2\/media\/205"}],"wp:attachment":[{"href":"https:\/\/anexia.com\/blog\/wp-json\/wp\/v2\/media?parent=7042"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/anexia.com\/blog\/wp-json\/wp\/v2\/categories?post=7042"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/anexia.com\/blog\/wp-json\/wp\/v2\/tags?post=7042"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}