Skip to content

fix: ignore .woff2 and modern static-asset extensions#5

Merged
marcin-prerender merged 1 commit into
mainfrom
fix/ignore-woff2-and-modern-static-assets
Jun 12, 2026
Merged

fix: ignore .woff2 and modern static-asset extensions#5
marcin-prerender merged 1 commit into
mainfrom
fix/ignore-woff2-and-modern-static-assets

Conversation

@marcin-prerender

Copy link
Copy Markdown
Contributor

The bug

The static-asset ignore list (EXTENSIONS_TO_IGNORE) predates woff2 and other modern web formats. Matching is suffix-based, so .woff does not cover .woff2 — bot requests for woff2 fonts were proxied to the Prerender service instead of passing through to the origin.

On top of that, _is_static_asset compared with path.endswith(ext) without lowercasing the path, while the contract mandates case-insensitive suffix matching — /STYLES.CSS was incorrectly sent to the rendering service.

Live evidence

Verified on prerender.io's own site: Googlebot requesting inter-*.woff2 gets a 504 (normal UA: 200), while .css/.js correctly bypass the service.

Coordinated propagation

This propagates the canonical contract change from prerender/integration-contract#1, which adds .woff2 .otf .eot .webp .avif .webmanifest to the static-asset ignore list (CONTRACT.md §3, case-insensitive suffix matching).

Changes

  • prerender_django/middleware.py: added .woff2, .otf, .eot, .webp, .avif, .webmanifest to EXTENSIONS_TO_IGNORE
  • prerender_django/middleware.py: _is_static_asset now lowercases the path before the suffix check (extensions are already lowercase)
  • tests/test_middleware.py: added test_font_asset_with_bot_ua_passes_through (/fonts/inter.woff2) and test_uppercase_static_asset_with_bot_ua_passes_through (/STYLES.CSS)

Full suite run locally: 13 passed (Python 3.14, pytest, contract mock server fetched per conftest instructions).

🤖 Generated with Claude Code

The static-asset ignore list predates woff2 and other modern web
formats. Because matching is suffix-based, '.woff' does not cover
'.woff2', so bot requests for woff2 fonts were proxied to the
Prerender service instead of passing through. Verified live on
prerender.io itself: Googlebot requesting inter-*.woff2 received a
504 while a normal UA received a 200 (.css/.js correctly bypassed).

Adds .woff2, .otf, .eot, .webp, .avif and .webmanifest to
EXTENSIONS_TO_IGNORE, per integration-contract CONTRACT.md section 3
(prerender/integration-contract#1).

Also fixes _is_static_asset to lowercase the request path before the
suffix check — the contract mandates case-insensitive matching, so
'/STYLES.CSS' must pass through like '/styles.css'.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@marcin-prerender marcin-prerender merged commit 63f6436 into main Jun 12, 2026
3 checks passed
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.

2 participants