Gridpane – WAF 7G – Custom Rules

Tech Articles | February 15, 2025 | 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 WAF Logs for the domain and it was that

Really easy to fix following this documentation, 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.
# Documentation: https://gridpane.com/kb/using-the-7g-web-application-firewall/
# This unblocs XXX Site + 
# Format "(1.1.1.1|XX.XX.XX.XX|XX.XX.XX.XX)

if ($remote_addr ~* "(1.1.1.1)") {
	set $7g_drop_bad_request 0;
	set $7g_drop_bad_referer 0;
	set $7g_drop_bad_query_string 0;
	set $7g_drop_not_allowed_method 0;
	set $7g_drop_bad_bot 0;
}
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

Support the Author

buy me a coffee
Really Useful Plugin Logo
Appoligies for any spelling and grammer issue. As a dyslexic i need to rely on tools for this they like me are not perfect but I do try my best