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
+11.7k Python : Convert IPv6 address to decimal and back to IPv6
+4k Golang : Convert lines of string into list for delete and insert operation
+12.9k Golang : concatenate(combine) strings
+4.5k Clean up Visual Studio For Mac installation failed disk full problem
+11.2k Golang : Listen and Serve on sub domain example
+5.7k Golang : Output or print out JSON stream/encoded data
+34k Golang : How to split or chunking a file to smaller pieces?
+6.4k Golang : Lock executable to a specific machine with unique hash of the machine
+11.6k Golang : Drop cookie to visitor's browser and http.SetCookie() example
+10.3k Golang : Fuzzy string search or approximate string matching example
+5k Fontello : How to load and use fonts?
+6.7k Gogland : Where to put source code files in package directory for rookie