<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: SitePostmortem editor</title>
    <description>The latest articles on DEV Community by SitePostmortem editor (@sitepostmortem).</description>
    <link>https://dev.to/sitepostmortem</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4252988%2Fb17cc7a0-9ff7-4d46-93ed-b97923a6e208.png</url>
      <title>DEV Community: SitePostmortem editor</title>
      <link>https://dev.to/sitepostmortem</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sitepostmortem"/>
    <language>en</language>
    <item>
      <title>"Astro trailing slash: three places that must agree, and how to check them"</title>
      <dc:creator>SitePostmortem editor</dc:creator>
      <pubDate>Thu, 19 Nov 2026 05:20:16 +0000</pubDate>
      <link>https://dev.to/sitepostmortem/astro-trailing-slash-three-places-that-must-agree-and-how-to-check-them-j06</link>
      <guid>https://dev.to/sitepostmortem/astro-trailing-slash-three-places-that-must-agree-and-how-to-check-them-j06</guid>
      <description>&lt;p&gt;The trailing slash is not cosmetic. It decides which URL your host answers &lt;em&gt;without a redirect&lt;/em&gt;, and everything else you write — internal links, canonical, sitemap — has to agree with it.&lt;/p&gt;

&lt;p&gt;With &lt;code&gt;build.format: 'directory'&lt;/code&gt;, Astro emits &lt;code&gt;page/index.html&lt;/code&gt;. A static host then serves &lt;code&gt;/page/&lt;/code&gt; directly and sends &lt;code&gt;/page&lt;/code&gt; through a 308 to get there. Measured on a site using &lt;code&gt;trailingSlash: 'always'&lt;/code&gt; plus the directory format:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -o /dev/null -w &lt;span class="s2"&gt;"%{http_code} %{redirect_url}"&lt;/span&gt; https://&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;site&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/about
308 https://&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;site&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/about/
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;One extra hop per internal link, invisible in the browser, paid by every crawler and every first-time visitor.&lt;/p&gt;

&lt;h2&gt;
  
  
  The three declarations
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Config&lt;/strong&gt; — &lt;code&gt;trailingSlash&lt;/code&gt; and &lt;code&gt;build.format&lt;/code&gt; decide the on-disk shape, which decides what the host serves without a redirect.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Links in the markup&lt;/strong&gt; — every &lt;code&gt;href&lt;/code&gt; you typed by hand, in markdown and in components.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;code&gt;canonical&lt;/code&gt; and the sitemap&lt;/strong&gt; — declarations of address, not navigational links.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;code&gt;always&lt;/code&gt; and &lt;code&gt;never&lt;/code&gt; are both defensible; mixing is not. &lt;code&gt;never&lt;/code&gt; asks the host to serve &lt;code&gt;/page&lt;/code&gt; for a file at &lt;code&gt;/page/index.html&lt;/code&gt;, and most static hosts redirect instead of doing that.&lt;/p&gt;

&lt;h2&gt;
  
  
  There is a fourth place, and it bites on Pages
&lt;/h2&gt;

&lt;p&gt;Cloudflare Pages strips the &lt;code&gt;.html&lt;/code&gt; extension. A file you linked as &lt;code&gt;/logo-compare.html&lt;/code&gt; is actually served at &lt;code&gt;/logo-compare&lt;/code&gt;. If your build emits a clean path and your link keeps the extension, you have a URL that is declared one way and served another — and the redirect makes it look fine in the browser.&lt;/p&gt;

&lt;h2&gt;
  
  
  Derive two, assert all three
&lt;/h2&gt;

&lt;p&gt;Set the decision once, in config, and generate the other two from it rather than typing them. Then assert, because hand-written URLs drift:&lt;/p&gt;

&lt;p&gt;Fetch every URL in your own sitemap and require &lt;strong&gt;200 with no redirect&lt;/strong&gt;, then compare the &lt;code&gt;canonical&lt;/code&gt; tag in that response against the URL you requested. Any mismatch is a place where you declared an address you do not serve.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -s https://&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;site&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/sitemap-0.xml &lt;span class="o"&gt;|&lt;/span&gt; grep -o &lt;span class="s1"&gt;'&amp;lt;loc&amp;gt;[^&amp;lt;]*'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; cut -c6- \
&lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="nb"&gt;read&lt;/span&gt; u&lt;span class="o"&gt;;&lt;/span&gt; &lt;span class="k"&gt;do&lt;/span&gt;
    &lt;span class="nv"&gt;code&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$(&lt;/span&gt;curl -s -o /dev/null -w &lt;span class="s1"&gt;'%{http_code}'&lt;/span&gt; &lt;span class="s2"&gt;"$u"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
    &lt;span class="o"&gt;[&lt;/span&gt; &lt;span class="s2"&gt;"$code"&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; 200 &lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;||&lt;/span&gt; &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"REDIRECT/ERR $code $u"&lt;/span&gt;
  &lt;span class="k"&gt;done&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Two lines, and it catches the whole class: slash mismatches, &lt;code&gt;.html&lt;/code&gt; leftovers, and canonical tags pointing at a URL that redirects.&lt;/p&gt;

&lt;h2&gt;
  
  
  What this does and does not cost
&lt;/h2&gt;

&lt;p&gt;A 308 is not fatal. Google follows it, and the destination gets indexed. The cost is that you have declared a canonical address that redirects, every internal link is one hop longer than it needs to be, and the sitemap may list URLs that are not the ones being served. None of those is an emergency; all of them are free to fix if you fix the declaration instead of the links.&lt;/p&gt;

&lt;p&gt;(The measured version, including the config and the sitemap crawl on our site, is here: &lt;a href="https://sitepostmortem.com/build-tools/astro-trailing-slash-mismatch/" rel="noopener noreferrer"&gt;https://sitepostmortem.com/build-tools/astro-trailing-slash-mismatch/&lt;/a&gt;)&lt;/p&gt;

</description>
      <category>astro</category>
      <category>webdev</category>
      <category>seo</category>
      <category>javascript</category>
    </item>
    <item>
      <title>"wrangler pages deploy replaces your deployment, not your site"</title>
      <dc:creator>SitePostmortem editor</dc:creator>
      <pubDate>Thu, 19 Nov 2026 05:20:15 +0000</pubDate>
      <link>https://dev.to/sitepostmortem/wrangler-pages-deploy-replaces-your-deployment-not-your-site-1o3d</link>
      <guid>https://dev.to/sitepostmortem/wrangler-pages-deploy-replaces-your-deployment-not-your-site-1o3d</guid>
      <description>&lt;p&gt;Every "my deploy succeeded but the site didn't change" thread has the same root: people expect &lt;code&gt;wrangler pages deploy&lt;/code&gt; to update a site. It updates a &lt;strong&gt;deployment&lt;/strong&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx wrangler pages deploy dist --branch main
✨ Uploaded 44 files
✨ https://&amp;lt;hash&amp;gt;.project.pages.dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That hash hostname is the thing you just created. Your production hostname follows it only if the deploy went to the production branch. And the directory you named &lt;em&gt;is&lt;/em&gt; the deployment — there is no merge with what was there before.&lt;/p&gt;

&lt;h2&gt;
  
  
  Symmetric consequences
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A file you added is served.&lt;/li&gt;
&lt;li&gt;A file you removed is gone from the live site, because it is not in the upload.&lt;/li&gt;
&lt;li&gt;A file you renamed becomes a new path plus a dead old path — which is how a site grows 404s nobody wrote.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Direct Upload has no notion of "keep the previous version's other files". That is not a bug to work around; it is the model.&lt;/p&gt;

&lt;h2&gt;
  
  
  Four causes, in the order they actually happen
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. The wrong directory.&lt;/strong&gt; &lt;code&gt;wrangler pages deploy .&lt;/code&gt; from the project root instead of &lt;code&gt;dist/&lt;/code&gt;. Success message, valid deployment URL, unchanged site — you uploaded source files no browser can render. Two instant checks: &lt;code&gt;ls dist/index.html&lt;/code&gt;, and the file count in the upload line versus what your build reports.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The wrong branch.&lt;/strong&gt; A deploy to a preview branch produces a real, reachable deployment that production never points at. &lt;code&gt;--branch main&lt;/code&gt; (or your project's production branch) is not decoration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. An edge cache still serving the old asset.&lt;/strong&gt; A deploy does not evict what a cache already holds. Add a query string: if &lt;code&gt;/path&lt;/code&gt; 200s with the old body and &lt;code&gt;/path?x=1&lt;/code&gt; 404s, the build is right and the cache is stale.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. You are looking at an old hash hostname.&lt;/strong&gt; Previous deployments stay reachable at their own URLs. Checking &lt;code&gt;&amp;lt;hash&amp;gt;.project.pages.dev&lt;/code&gt; from a bookmark, or from a link someone pasted last week, tells you nothing about production.&lt;/p&gt;

&lt;h2&gt;
  
  
  About --commit-dirty=true
&lt;/h2&gt;

&lt;p&gt;It lets the deploy proceed when the working tree has uncommitted changes. It suppresses a prompt. It does not change what gets uploaded, and it is not a "force" flag for content.&lt;/p&gt;

&lt;h2&gt;
  
  
  The one-way door
&lt;/h2&gt;

&lt;p&gt;You cannot switch a Direct Upload project to Git integration later. Cloudflare's docs are explicit: that is a new project. Worth knowing before you pick a workflow, because it is the kind of detail that only surfaces when someone asks for preview builds per PR.&lt;/p&gt;

&lt;h2&gt;
  
  
  Verification that survives a rewrite
&lt;/h2&gt;

&lt;p&gt;Don't assert the deploy log; assert the artifact. After upload, curl the production host for one changed path and one removed path:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -sI https://&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;site&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;changed-path&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;  &lt;span class="o"&gt;|&lt;/span&gt; head -1
curl -sI https://&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;site&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;removed-path&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;  &lt;span class="o"&gt;|&lt;/span&gt; head -1
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Expect 200 and 404/301. If the changed path 200s with old bytes, you are in cause 3. If the removed path still 200s, check whether it is cache or upload before touching config — the query-string test separates them in one request.&lt;/p&gt;

&lt;p&gt;(Full write-up with the four failure signatures on our site: &lt;a href="https://sitepostmortem.com/build-tools/wrangler-pages-deploy-stale/" rel="noopener noreferrer"&gt;https://sitepostmortem.com/build-tools/wrangler-pages-deploy-stale/&lt;/a&gt;)&lt;/p&gt;

</description>
      <category>cloudflare</category>
      <category>webdev</category>
      <category>devops</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>"A deleted page kept answering 200 on Cloudflare Pages for 39 minutes"</title>
      <dc:creator>SitePostmortem editor</dc:creator>
      <pubDate>Thu, 19 Nov 2026 05:20:05 +0000</pubDate>
      <link>https://dev.to/sitepostmortem/a-deleted-page-kept-answering-200-on-cloudflare-pages-for-39-minutes-c5j</link>
      <guid>https://dev.to/sitepostmortem/a-deleted-page-kept-answering-200-on-cloudflare-pages-for-39-minutes-c5j</guid>
      <description>&lt;p&gt;We deleted six design drafts from a static site, deployed, and one of them kept answering on the custom domain. The build was clean. The deploy log was clean. The page was gone from &lt;code&gt;dist&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -sI https://&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;site&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;/logo-compare &lt;span class="o"&gt;|&lt;/span&gt; grep -iE &lt;span class="s2"&gt;"^(HTTP|cache-control|age|cf-cache)"&lt;/span&gt;
HTTP/2 200
cache-control: public, s-maxage=604800
age: 2346
cf-cache-status: DYNAMIC
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The file had not existed for 39 minutes. &lt;code&gt;s-maxage=604800&lt;/code&gt; is a seven-day freshness instruction for shared caches, and &lt;code&gt;Age: 2346&lt;/code&gt; says the copy had already been sitting there. The body under that 200 was the deleted page, complete with the &lt;code&gt;noindex&lt;/code&gt; header its old config used to send.&lt;/p&gt;

&lt;p&gt;That is the part worth internalising: &lt;strong&gt;a deploy and a purge are different operations.&lt;/strong&gt; A deploy publishes a new deployment and points the project at it. A purge evicts a cached copy of a response. Neither implies the other.&lt;/p&gt;

&lt;h2&gt;
  
  
  Two caches in front of one deployment
&lt;/h2&gt;

&lt;p&gt;Cloudflare's Pages docs describe the asset as remaining "cached on the Cloudflare CDN until your next deployment". For a proxied custom domain they add that "Cache Rules and legacy Page Rules can cache responses in your zone before requests reach Pages. This cache is separate from Pages' built-in caching and can serve stale content after a deployment."&lt;/p&gt;

&lt;p&gt;Two layers, one of which a deploy does not clear.&lt;/p&gt;

&lt;h2&gt;
  
  
  The 60-second test that names the layer
&lt;/h2&gt;

&lt;p&gt;Add a query string. A cache key includes it, so &lt;code&gt;?x=1&lt;/code&gt; is a different key: it misses any copy stored without it and reaches the deployment, where the file no longer exists.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Request&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;th&gt;What it proves&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/logo-compare&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;200, old body&lt;/td&gt;
&lt;td&gt;a cache answered&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;/logo-compare?x=1&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;404&lt;/td&gt;
&lt;td&gt;the build is correct&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;pages.dev/logo-compare&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;404&lt;/td&gt;
&lt;td&gt;same deployment, different hostname&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;If the plain path 200s and the query string 404s, you are not debugging a build. You are debugging a cache. If both 200, the file is still in the uploaded directory.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why it matters beyond embarrassment
&lt;/h2&gt;

&lt;p&gt;A 200 keeps a URL you deleted crawlable. Google treats 200 as a live page, so a retired draft, an old price or a removed location can stay retrievable while you believe it is gone. Deleting the file and calling it done is how sites end up publicly stating something that stopped being true.&lt;/p&gt;

&lt;h2&gt;
  
  
  Purge is the painkiller, not the cure
&lt;/h2&gt;

&lt;p&gt;"Purge Everything" is safe and fast, and it will not stop the next deploy from doing the same thing — Cloudflare's own note is that purging alone does not prevent stale content after future deployments when a caching rule is the cause. Purge to clear the copy, then remove what produced it: a page rule, a cache rule, or a deploy gate that never checks the path you deleted.&lt;/p&gt;

&lt;p&gt;Our fix was &lt;code&gt;_redirects&lt;/code&gt;: the seven retired paths now return 301 to &lt;code&gt;/&lt;/code&gt;, with and without a query string, which is cheaper than arguing with a cache.&lt;/p&gt;

&lt;h2&gt;
  
  
  Assert the artifact, not the deploy log
&lt;/h2&gt;

&lt;p&gt;After each release, request the paths you removed and require 404 or 301. Then request the new paths and compare bytes. Under a minute for both, and it covers the two halves of this failure: a deploy that shipped the wrong tree, and a cache that shipped the right tree late.&lt;/p&gt;

&lt;p&gt;(The full incident, with the response headers and the &lt;code&gt;_redirects&lt;/code&gt; entries, is written up on our own site: &lt;a href="https://sitepostmortem.com/build-tools/cloudflare-pages-cache-purge/" rel="noopener noreferrer"&gt;https://sitepostmortem.com/build-tools/cloudflare-pages-cache-purge/&lt;/a&gt;)&lt;/p&gt;

</description>
      <category>cloudflare</category>
      <category>webdev</category>
      <category>devops</category>
      <category>performance</category>
    </item>
  </channel>
</rss>
