Block access to my website

Hi, I would want to block requests to my website which includes URI path and request method. My firewall rule expression is:

( eq and http.request.uri.path eq /api/session and http.request.method eq “POST”)

As checked, it doesn’t seem to block requests to the site. I might be doing something wrong. Any help would be appreciated.

You most likely dont need the host check. As for the other two expressions, this rule will block POST requests to exactly /api/session, not /api/session/whatever for example.

Is this what you intended?

I forgot to tell, I have multiple sites in my zone. I would like to block access to one site only (for example: block and not And yes, I’ll block /api/session and not /api/session/whatever.

Zone? Do you mean you have several records beneath your one domain on Cloudflare and you want to match the firewall rule only for one specific host?

Or do you mean you have several domains in your account?

Ah yes, I have several records on my domain and I want to match the firewall rule for a specific host. I apologize for the confusion.

Alright, yes, in this case you need the host expression.

Anyhow, your rule looks fine and should block requests matching it. Have you verified these requests are not bypassing Cloudflare and connect directly?

It seems the rule worked now! I probably should’ve given the firewall rule some time before actually testing. Anyway, thanks for the help!

This topic was automatically closed after 30 days. New replies are no longer allowed.