Documentation Index
Fetch the complete documentation index at: https://docs.ahmadraza.in/llms.txt
Use this file to discover all available pages before exploring further.
Create a Cloudflare WAF rule
Step 1: Create a WAF Rule to Match Sensitive URIs
-
Log in to Cloudflare:
- Go to Cloudflare and log in with your credentials.
-
Select the Domain:
- Choose the domain where your Laravel application is hosted.
-
Navigate to the WAF Section:
- Go to the
Securitytab and selectWAF.
- Go to the
-
Create a New WAF Rule:
- Click on
Create a Firewall Rule.
- Click on
-
Configure the Rule:
- Rule Name: Give your rule a descriptive name, like
Match Sensitive File Requests. - When incoming requests match…:
-
Use the Field dropdown to select
URI Path. -
Set the Operator to
contains. -
Add the sensitive paths you want to match:
-
Use the Field dropdown to select
- Rule Name: Give your rule a descriptive name, like
-
Choose the Action:
- Set the action to
Challenge.
- Set the action to
-
Deploy the Rule:
- Save and deploy the rule.
Step 2: Set Up a Rate Limiting Rule
-
Navigate to the Rate Limiting Section:
- Go to the
Rulestab and selectRate Limiting.
- Go to the
-
Create a New Rate Limiting Rule:
- Click on
Create a Rate Limiting Rule.
- Click on
-
Configure the Rule:
-
Rule Name: Give your rule a descriptive name, like
Rate Limit Sensitive File Requests. -
When incoming requests match…:
-
Set the Field to
URI Path. -
Set the Operator to
contains. -
Add the path you want to match:
-
Set the Field to
- Request URL: Match the request URL as per your need.
-
Threshold: Set to
10. -
Period: Set to
10 minutes. -
Action: Choose
Blockand set the duration for how long you want to block the IP, e.g.,1 hour.
-
Rule Name: Give your rule a descriptive name, like
-
Deploy the Rule:
- Save and deploy the rule.
Example WAF Rule Expression
Here’s how the WAF rule expression might look:Example Rate Limiting Rule
-
When incoming requests match…:
- Field:
URI Path - Operator:
contains - Value:
.envorenv
- Field:
-
Threshold:
10 -
Period:
10 minutes -
Action:
Block -
Duration:
1 hour
Save and Apply
- After configuring both the WAF and rate limiting rules, save and apply the changes.
.env files or similar paths multiple times, enhancing the security of your Laravel application.