Skip to content

Remove mod_deflate and ETag stripping to fix CDN 404s#1634

Open
davsclaus wants to merge 1 commit into
mainfrom
fix/1631-htaccess-cleanup
Open

Remove mod_deflate and ETag stripping to fix CDN 404s#1634
davsclaus wants to merge 1 commit into
mainfrom
fix/1631-htaccess-cleanup

Conversation

@davsclaus

Copy link
Copy Markdown
Contributor

Summary

  • Remove the entire mod_deflate compression section (~200 lines) from .htaccess
  • Remove the ETag stripping section

Why

The sporadic 404 errors (#1631, #1565, INFRA-27679) are correlated with Accept-Encoding: gzip — browsers get 404s but curl (which doesn't send gzip by default) works fine.

mod_deflate removal: The .htaccess had Apache's mod_deflate handling compression on the origin, including a decade-old workaround for "mangled Accept-Encoding" headers. With Fastly CDN in front, the CDN handles compression — having Apache also do it can interfere with Fastly's Vary: Accept-Encoding cache key handling, contributing to the gzip-specific 404s. The removed sections include:

  • SetEnvIfNoCase workaround for mangled encoding headers
  • AddOutputFilterByType DEFLATE for all MIME types
  • AddEncoding gzip svgz
  • Commented-out Brotli and GZip pre-compressed content sections (unused)

ETag removal: The .htaccess was stripping ETags (Header unset ETag + FileETag None). ETags are actually useful for Fastly's cache validation — removing them forces full re-fetches on every cache miss instead of efficient 304 Not Modified responses.

Test plan

  • Verify pages still load correctly after deploy
  • Verify Content-Encoding: gzip is still present in responses (handled by Fastly)
  • Monitor for 404 recurrence, especially with Accept-Encoding: gzip requests
  • Verify .svgz files still render correctly (Fastly should handle the encoding)

Fixes #1631

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Reduce website size and fix CDN 404s — root cause analysis and action plan

1 participant