Block sitemap for every one except cf bots

i am trying to block all request from others except cf boat
(http.request.full_uri eq "https://domain.com/sitemap_index.xml") or (http.request.full_uri eq "https://domain.com/page-sitemap.xml") or (http.request.full_uri eq "https://domain.com/post-sitemap1.xml") or (http.request.full_uri eq "https://domain.com/post-sitemap2.xml") or (http.request.full_uri eq "https://domain.com/post-sitemap3.xml") or (http.request.full_uri eq "https://domain.com/post-sitemap4.xml") or (http.request.full_uri eq "https://domain.com/post-sitemap5.xml") or (http.request.full_uri eq "https://domain.com/category-sitemap.xml" and not cf.client.bot)

after enabling this rule in waf google inspect tool gives 403 can any one help me on this
spam bots taking urls from here and post every where as 404 pages

You’ll need to manually edit that expression in the Expression Editor to get the parentheses to group properly:

((http.request.full_uri eq "https://domain.com/sitemap_index.xml") or (http.request.full_uri eq "https://domain.com/page-sitemap.xml") or (http.request.full_uri eq "https://domain.com/post-sitemap1.xml") or (http.request.full_uri eq "https://domain.com/post-sitemap2.xml") or (http.request.full_uri eq "https://domain.com/post-sitemap3.xml") or (http.request.full_uri eq "https://domain.com/post-sitemap4.xml") or (http.request.full_uri eq "https://domain.com/post-sitemap5.xml") or (http.request.full_uri eq "https://domain.com/category-sitemap.xml")) and not (cf.client.bot)

This groups all the URL check OR statements, then adds the AND NOT cf bot at the end.

can you give the working expression

Excuse me? That was it, right there. Paste it into the Expression Editor:

2 Likes

wow the above solution worked thanks mate can u suggest some ips to exclude from that blocking rule

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