Unix/Linux : How to test user agents blocked successfully ?
This is actually a continuation from the tutorial on how to configure nginx to block certain user agents. To test if a web server will response with the configured response status... you can use curl
command.
For example :
curl -I https://www.somewebsite.com
will return HTTP/1.1 200 OK
status
and if the Nginx or Apache web server is configured to block certain user agents .... let say wget
try adding -H 'User-agent: wget'
parameter to the curl command like below
curl -I -H 'User-agent: wget' https://www.somewebsite.com
and it will return HTTP/1.1 403 Forbidden
status
Hope this quick tutorial is helpful for you to check if your Nginx configuration or Apache configuration to block certain user agents is working successfully or not.
By Adam Ng
IF you gain some knowledge or the information here solved your programming problem. Please consider donating to the less fortunate or some charities that you like. Apart from donation, planting trees, volunteering or reducing your carbon footprint will be great too.
Advertisement
Tutorials
+23.7k Golang : Convert long hexadecimal with strconv.ParseUint example
+11.7k Golang : http.Get example
+26.6k Golang : Change a file last modified date and time
+7.4k Golang : Convert word to its plural form example
+9.2k Golang : Convert file unix timestamp to UTC time example
+15.5k Golang : How to generate QR codes?
+3.9k Golang : Calculate a pip value and distance to target profit example
+21.6k Golang : Calculate time different
+4.2k Python : Create Whois client or function example
+44.1k Golang : Read tab delimited file with encoding/csv package
+15.8k Golang : Get number of CPU cores
+6.6k Gogland : Single File versus Go Application Run Configurations