Skip to content
Snippets Groups Projects
Commit 52b96c47 authored by Allan Chappell's avatar Allan Chappell Committed by Vojislav Jovanovic
Browse files

Issue #3356426 by generalredneck, vaish: Any way to tell if it is working??

parent 62a59866
No related branches found
Tags 7.x-4.0-rc1
1 merge request!1Updating docs with how to test instructions
......@@ -159,6 +159,47 @@ Install Crawler Rate Limit module
3. Visit Status report page (/admin/reports/status) and confirm that Crawler
Rate Limit is enabled and it doesn't report any warnings or errors.
Test your installation
======================
To validate rate limiting is working, even on setups with edge implementations,
we can use curl to quickly hit the site multiple times. Keep in mind each
request speed will be subject to your connectivity to site, but in most cases,
you can expect about 1 request a second.
To test bot rate limiting, run the following:
```bash
for i in `seq 1 101`; do curl -A "Bytespider" -kLI https://example.com/?i=$i; done
```
Change 101 to one more than your rate limit, and https://example.com/ to the url
of your website where Crawler Rate Limit is installed. If your first requests
are not HTTP/2 200, ensure you don't have "Bytespider" blocked by other means,
or try a different bot user agent. Your last response should look something
like:
```
HTTP/2 429
cache-control: no-cache, private
content-type: text/html; charset=UTF-8
date: Sat, 20 Apr 2024 15:05:38 GMT
retry-after: 600
server: Apache/2.4.56 (Debian)
x-powered-by: PHP/8.1.28
```
If you want to validate that the functionality is working across ip addresses,
rerun the code above from another machine with a different IP address. You
should receive `HTTP/2 429` from the other machine as long as you do so within
the configured time limit, and ensure you are using the same user agent.
To validate rate limiting is working for regular traffic, do the same as above,
but change your user agent from `"Bytespider"` to `"Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36"`.
The difference here is if you try this same code from another machine with a
different IP address, within the configured time limit, you should not be
rate limited immediately.
How to update to version 3
==========================
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment