How to block special URL

Hi

I see a ton of requests that are invalid from chatgpt to pages like:

https://domain.com/s/b/18804?pageNumber=117

I would like to block any time there is a number that doesn’t have before
pageNumber=
or
page=

But
These would work:
https://domain.com/s/b/?pageNumber=117
https://domain.com/t/?page=2

Would love to get some insights.

Thank you
Ron

Try this:

(http.request.uri.query contains "page") and ((ends_with(http.request.uri.path, "0")) or (ends_with(http.request.uri.path, "1")) or (ends_with(http.request.uri.path, "2")) or (ends_with(http.request.uri.path, "3")) or (ends_with(http.request.uri.path, "4")) or (ends_with(http.request.uri.path, "5")) or (ends_with(http.request.uri.path, "6")) or (ends_with(http.request.uri.path, "7")) or (ends_with(http.request.uri.path, "8")) or (ends_with(http.request.uri.path, "9")))

If there’s a query string with “page”, AND the path ends with a digit, then block.

1 Like

but then it would block
https://domain.com/t/?page=2 which is a legit page, no?

No. That digit is in the query string. Not the path.

Have you tried the rule?

1 Like

I have tried and it blocked the wanted page
https://domain.com/s/a/?pageNumber=2

I just re-tested, and it’s working as expected for me:

https://b8a.me/s/a/?pageNumber=2

The above URL gets redirected by the server, but not blocked by Cloudflare.

If you run it through Cloudflare Trace, you should be able to see which rule is blocking it.

1 Like

You are right, I just tried again and it works.

thank you

2 Likes

what would be a way to block also pages like this:
https://domain.com/s/2
?

@sdayman i tried this one

(http.request.uri.path contains "/s/" and not http.request.uri.path contains "page|pageNumber" and http.request.uri.path contains "\\/[0-9]+$")

but it didn’t work, what am I missing here?

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.