Filter pages and crawlers
A shop with a handful of filters has tens of thousands of addresses, and crawlers will try to visit every one. A few changes in your app keep them on the pages that matter, and the Protection card catches the rest.
Why these pages get hit
Pages whose address changes with every filter or search, such as
/laptops?memory=16gb&storage=512gb&sort=price, are the easiest pages for a
crawler or a scraper to overload:
- Every combination is a new address. Three filters with ten values each already make a thousand pages. Add sorting and paging and it is many more.
- None of them can be cached. Each address is asked for once, so your app builds every page from scratch, usually with a database query behind it.
- Crawlers follow every link. A filter sidebar is a page of links, so a crawler that lands on one filtered page finds hundreds more.
The result looks like an attack, but it is often Google, Meta or an AI crawler doing what it was built to do. The four changes below stop polite crawlers from wandering into the combinations. The platform settings at the end deal with the ones that are not polite.
1. Tell crawlers to skip filter combinations
Add a Disallow line to your robots.txt for each filter parameter. Most
crawlers, Google and Bing included, understand * as "anything":
User-agent: *
Disallow: /*?*memory=
Disallow: /*?*storage=
Disallow: /*?*sort=
Disallow: /*?*page=
Disallow: /search- List the parameters, not the pages.
/*?*sort=coverssorton every page of your app, wherever it appears in the address. - Leave the plain pages crawlable.
/laptopsshould stay open, so it can still rank. - Serve it at the root. Crawlers only read
https://your-domain/robots.txt. In Next.js, aapp/robots.tsfile builds it for you.
robots.txt stops crawling, not indexing. A filtered page that is already in
search results can stay there for a while. Step 3 is what removes it.
2. Mark filter links rel="nofollow"
Give each filter link rel="nofollow", so crawlers do not follow it:
<a href="/laptops?memory=16gb" rel="nofollow">16 GB</a>Even better, do not link to the combinations at all. Use checkboxes or buttons that update the address in the browser with JavaScript. People get the same page, and there is no link for a crawler to follow.
3. Point filtered pages at the plain one
Give every filtered page a canonical link to the unfiltered page, and ask search engines not to index it while any filter is set:
<!-- on /laptops?memory=16gb&sort=price -->
<link rel="canonical" href="https://your-domain/laptops" />
<meta name="robots" content="noindex, follow" />Search engines then rank /laptops and visit the combinations much less
often. Keep paging (?page=2) canonical to itself if you want those pages
found, and use noindex only on filters and sorting.
4. Put a limit on combinations
Your app can refuse the requests no person would make:
- Cap the number of filters. Turn away a request with more than four
filters at once with a
400, or ignore the extra ones. - Ignore unknown values.
?memory=bananashould not run a query. - Sort the values before you look anything up.
memory=16gb&storage=512gbandstorage=512gb&memory=16gbare the same choice. Sorting them first means both hit the same cache entry. - Cache the results for a minute. Even a short cache turns a burst of identical requests into one query.
What the platform does for you
Steps 1 to 3 work because the big crawlers follow them. Scrapers do not, and
some crawlers ignore robots.txt or move faster than your app can answer. Your
web service's Settings → Protection card covers those:
- Crawler budget. Each search, ads and AI crawler may send about 5 requests
a second to your app, however many addresses it crawls from. Over that it
gets a
429with aRetry-Afterheader and slows down. It is never blocked, so your app still shows up in search results and AI answers. - Cap busy traffic. At most a set number of requests are open at once for
your app, from everyone together (32 for each CPU core, at least 16). When a
flood fills that, new requests get a quick
429instead of waiting, and your app stays fast for everyone already on it. It catches scrapers that spread one or two requests over thousands of addresses, which a per-visitor limit never sees. - A rate limit on just these paths. On a paid service, a Custom rate limit
can apply to only
/searchor/laptops, and leave the rest of your app unlimited.
On paid apps the traffic cap and the crawler budget may already be on. The card says so.
Related: Protect your app and Instance types & regions.