Rules

Accessible for the Developer and Business plan users only.
https://app.patchstack.com/protection/rules

In the Rules subpage you can create and modify the firewall rules and attach them to certain applications.
A firewall rule can block or whitelist requests based on patterns. They can be assigned to sites directly or attached to a module.

Creating a rule

To create a custom rule, click on the + Create Rule button.
A new page opens up with a firewall rule creation form (see the image below).

Adding a simple rule:

  1. Give your rule a name
  2. To the next field (If the IP address matches...) you can type an IP address, CIDR notation, or wildcards. For example:
    • 127.0.0.1
    • 127.0.0.1/24
    • 127.0.0.*
  3. Next field is another condition - if the requesting URL contains - there you can type any URL pattern (e.g. contact-form/submit)
  4. In the last field you can choose, what action to take if your web app visitor matches all the rules you just set. Your options are to
    • Block
    • Redirect
    • Log
    • Whitelist
  5. When you choose "Redirect", a new field opens up, where you can type, which URL the visitor will be redirected to
  6. Having filled the fields, click Create Rule

Finally, you should see your created rule on the Rules page.

Attaching the rule to your app

If you want this rule to take effect, you need to attach it to your apps. To do that:

  1. Navigate to Rules tab
  2. Click on "Action" and "Attach Apps"
  3. A popup appears with the list of all your apps
  4. Toggle the button to attach your rule. You can attach as many apps as you wish
  5. Close the popup

Now you need to sync your sites. To do that:

  1. Click on "Resync Apps" at the top right corner
  2. From the popup you can click "Resync All" so all your apps will be updated

You have now successfully created a firewall rule and attached it to your site!

In the next article let's take a look at Firewall Modules. A firewall module is a group of custom firewall rules, which can be applied to your apps, all at once.