Content blocks¶
Follow these steps to configure conditional blocking. i.e. to block the requests based on conditions. Typical use-cases are:
- block malicious request URLs.
- block the IPs you found making malicious requests.
- block requests coming from certain bots.
- block requests coming from certain countries.
Note: For demo purpose, we will be using www.nviztest.com
domain as an example.
Here, we will be blocking a certain set of IPs.
Prerequisite¶
- You must have a domain configured on Nitrogen.
- For this example to work, you should have created an IP based condition. If not, you can refer this article for the same.
Steps¶
-
Click on
Security
menu, then selectContent Blocks
tab. Select appropriate domain from the domains dropdown. -
Click on
Add New
button at top right corner. You will be taken to a screen to provide details about block conditions. Provide the required details:-
Comment
: Provide short detail about the caching pattern/rule. Enter Vary wordpress admin and normal user for example. Note: Please keep the comment meaningful and relevant. -
If
: Here we will be specifying what to be added to cache-key when the condition matches.-
Pattern Type
: We can configure block based on multiple conditions. e.g. URL-pattern, HTTP-method, request-header, cookie, request-user's origin-country, request-IP, request-user's device-type, request's user-agent Select IP for now. -
Check
: Select either matches or not matches as per your requirement. We will select matches here. -
Condition Value
: Select the condition pattern. Here, select IP Blocklist as per the example requirement.
-
-
So now the condition for this blocking is
Block any request > if it is from the IP > which is present in the given IP-Blocklist
. Note: You can add multiple conditions as per your need, by clicking+And
button. -
Click on
Save
button. The configured rule will be showed inContent Blocks
list.
-
Notes¶
These changes will only take effect when deployed. Saving them will only be saving them in draft. Please refer documentation about Deploy process for it.