Skip to content

Commit 63a13e2

Browse files
marcin-prerenderMarcinclaude
authored
fix: ignore modern static-asset extensions (#277)
Add .otf, .eot and .avif to extensionsToIgnore and remove the duplicated .doc entry. Verified live that Googlebot requesting prerender.io's own inter-*.woff2 receives a 504 (a normal UA gets 200): the Prerender service rejects static-asset URLs with 504, so any font/image request forwarded by the middleware surfaces as a crawler-visible 5xx. Aligns with the canonical static-asset ignore list in prerender/integration-contract#1. Co-authored-by: Marcin <marcin@prerender.com> Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
1 parent 68804ff commit 63a13e2

2 files changed

Lines changed: 14 additions & 2 deletions

File tree

‎index.js‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,6 @@ prerender.extensionsToIgnore = [
177177
'.rar',
178178
'.exe',
179179
'.wmv',
180-
'.doc',
181180
'.avi',
182181
'.ppt',
183182
'.mpg',
@@ -200,9 +199,12 @@ prerender.extensionsToIgnore = [
200199
'.woff',
201200
'.woff2',
202201
'.ttf',
202+
'.otf',
203+
'.eot',
203204
'.svg',
204205
'.webmanifest',
205-
'.webp'
206+
'.webp',
207+
'.avif'
206208
];
207209

208210

‎test/index-spec.js‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,16 @@ describe ('Prerender', function(){
162162
assert.equal(res.end.callCount, 0);
163163
});
164164

165+
it('should call next() if user is a bot, but the bot is requesting a font file', function(){
166+
var req = { method: 'GET', url: '/fonts/inter.woff2?v=3', headers: { 'user-agent': bot } };
167+
168+
prerender(req, res, next);
169+
170+
assert.equal(next.callCount, 1);
171+
assert.equal(res.writeHead.callCount, 0);
172+
assert.equal(res.end.callCount, 0);
173+
});
174+
165175
it('should call next() if the url is not part of the regex specific whitelist', function(){
166176
var req = { method: 'GET', url: '/saved/search/blah?_escaped_fragment_=', headers: { 'user-agent': bot }, connection: { encrypted: false } };
167177

0 commit comments

Comments
 (0)