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
+15k Golang : Get timezone offset from date or timestamp
+17.7k Golang : Get all upper case or lower case characters from string example
+13.9k Elastic Search : Mapping date format and sort by date
+10.2k Golang : Allow Cross-Origin Resource Sharing request
+15.1k Golang : invalid character ',' looking for beginning of value
+5.1k Unix/Linux : How to archive and compress entire directory ?
+9.3k Golang : Validate IPv6 example
+18.8k Golang : Populate dropdown with html/template example
+16.3k Golang : Merge video(OpenCV) and audio(PortAudio) into a mp4 file
+8k Golang : Emulate NumPy way of creating matrix example
+5.5k List of Golang XML tutorials
+8.5k Golang : Accept any number of function arguments with three dots(...)