Skip to content

Commit 649b685

Browse files
Marcinclaude
andcommitted
fix: ignore .woff2 and modern static-asset extensions
The EXTENSIONS_TO_IGNORE list predates woff2 and other modern asset formats. Matching is case-insensitive suffix matching, so ".woff" does not cover ".woff2" — bot requests for woff2 fonts were forwarded to the Prerender service instead of passing through to the servlet chain. Aligns with the integration contract (CONTRACT.md §3): adds .woff2, .otf, .eot, .webp, .avif, .webmanifest. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 1f40092 commit 649b685

2 files changed

Lines changed: 13 additions & 1 deletion

File tree

src/main/java/io/prerender/PrerenderConfig.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ class PrerenderConfig {
1818
".pdf", ".doc", ".txt", ".ico", ".rss", ".zip", ".mp3", ".rar",
1919
".exe", ".wmv", ".avi", ".ppt", ".mpg", ".mpeg", ".tif", ".wav",
2020
".mov", ".psd", ".ai", ".xls", ".mp4", ".m4a", ".swf", ".dat",
21-
".dmg", ".iso", ".flv", ".m4v", ".torrent", ".ttf", ".woff", ".svg"
21+
".dmg", ".iso", ".flv", ".m4v", ".torrent", ".ttf", ".woff", ".svg",
22+
".woff2", ".otf", ".eot", ".webp", ".avif", ".webmanifest"
2223
);
2324

2425
private static final String DEFAULT_SERVICE_URL = "https://service.prerender.io/";

src/test/java/io/prerender/PrerenderFilterTest.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,17 @@ void botRequest_staticAsset_passesThrough() throws Exception {
9696
verify(response, never()).setStatus(anyInt());
9797
}
9898

99+
@Test
100+
void botRequest_fontAsset_passesThrough() throws Exception {
101+
when(request.getMethod()).thenReturn("GET");
102+
when(request.getRequestURI()).thenReturn("/fonts/inter.woff2");
103+
104+
filter.doFilter(request, response, chain);
105+
106+
verify(chain).doFilter(request, response);
107+
verify(response, never()).setStatus(anyInt());
108+
}
109+
99110
@Test
100111
void escapedFragment_triggersPrerender() throws Exception {
101112
wireMock.stubFor(get(anyUrl())

0 commit comments

Comments
 (0)