---
title: Gridpane - WAF 7G - Custom Rules
date: 2025-02-15T14:55:33Z
modified: 2025-02-15T14:55:36Z
permalink: "https://techarticles.co.uk/gridpane-waf-7g-custom-rules/"
type: post
status: publish
excerpt: ""
wpid: 4534
categories:
  - Coding
  - FlowMattic
  - GridPane
  - Hosting
  - Wordpress
timestamp: 2025-02-15T14:55:36Z
tags:
  - Coding
  - FlowMattic
  - GridPane
  - Hosting
  - Wordpress
---

I was doing some testing this afternoon, and the WAF was blocking the trigger I was creating. and I couldn’t do anything about it after checking with the security logs in Cloudflare (Cloudflare **Dashboard → Security → Events**) ; there where none I then checked the [Gridpane](https://ta0.uk/gridpane) WAF Logs for the domain and it was that

Really easy to fix following this [documentation, ](https://gridpane.com/kb/using-the-7g-web-application-firewall/)and below is what I did for my future reference

1. SFTP FileZilla to the following location: /var/www/yourwebsite-address/nginx
2. If not already create a ip-whitelist-7g-context.conf
3. Add the code below to that file, change the IP Address, or add one in the format detailed if already there
4. Putty in and type nginx -t in the command prompt
5. If there are no errors, type gp ngx reload and your rule should now be working.

```
<span class="line"><span style="color: #E1E4E8"># Documentation: https:</span><span style="color: #6A737D">//gridpane.com/kb/using-the-7g-web-application-firewall/</span></span>
<span class="line"><span style="color: #E1E4E8"># This unblocs XXX Site + </span></span>
<span class="line"><span style="color: #E1E4E8"># Format </span><span style="color: #9ECBFF">"(1.1.1.1|XX.XX.XX.XX|XX.XX.XX.XX)</span></span>
<span class="line"></span>
<span class="line"><span style="color: #9ECBFF">if ($remote_addr ~* "</span><span style="color: #E1E4E8">(</span><span style="color: #79B8FF">1.1</span><span style="color: #E1E4E8">.</span><span style="color: #79B8FF">1.1</span><span style="color: #E1E4E8">)</span><span style="color: #9ECBFF">") {</span></span>
<span class="line"><span style="color: #9ECBFF">	set $7g_drop_bad_request 0;</span></span>
<span class="line"><span style="color: #9ECBFF">	set $7g_drop_bad_referer 0;</span></span>
<span class="line"><span style="color: #9ECBFF">	set $7g_drop_bad_query_string 0;</span></span>
<span class="line"><span style="color: #9ECBFF">	set $7g_drop_not_allowed_method 0;</span></span>
<span class="line"><span style="color: #9ECBFF">	set $7g_drop_bad_bot 0;</span></span>
<span class="line"><span style="color: #9ECBFF">}</span></span>
```JSON

**Note: This is on a site-by-site basis ( See modification below for server-wide)**

1. Change Location to /etc/nginx/extra.d/
2. If not already created create ipwhitelists-7g-context.conf
3. **The rest of the steps are the same**