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
+12.1k Golang : Split strings into command line arguments
+10.5k Golang : Select region of interest with mouse click and crop from image
+5.4k Javascript : How to loop over and parse JSON data?
+7.7k Golang : get the current working directory of a running program
+11.3k Golang : Characters limiter example
+14.9k Golang : Basic authentication with .htpasswd file
+5.7k Golang : ROT32768 (rotate by 0x80) UTF-8 strings example
+6.9k How to let Facebook Login button redirect to a particular URL ?
+13k Golang : Calculate elapsed years or months since a date
+11.7k Golang : Gorilla web tool kit secure cookie example
+11.9k Golang : How to parse plain email text and process email header?
+8.1k Golang : Append and add item in slice