Regex in WAF rules

Hello!

I’d like to create WAF rule to block several hostnames (unique).
Should I use hostname just | and list all domain names?

Thanks,

1 Like

Regex is only available in Business and higher plans. You’ll have to use inand create it as a list of hostnames.

Also, Hostname requires the full hostname ie site-doc.example.com.

2 Likes

Thank you for your response. yes, we do have Bussiness account.
I didn’t get regarding to use in. Could you please provide an example?

Thanks,

Sorry I got the syntax wrong, it is matches for regex.

You probably want something like
http.host matches "(site-doc|site-life|sitelife|si-telife|siteli-fe)\.example\.com"
which would result in blocking requests to

got it! I’ll try then.
Very appreciate your advice.

Sorry, one more question: for referer will be the same syntax?

You can use matches for any string field (list of fields). The syntax of the rule might need to be changed as refer is the full web page address and not just the hostname. From the docs, an example value would be Referer: htt­ps://developer.example.org/en-US/docs/Web/JavaScript.

I see! Thank you!

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