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
+4.6k Nginx and PageSpeed build from source CentOS example
+21.5k Golang : How to reverse slice or array elements order
+6.3k Golang : Embedded or data bundling example
+5.4k Golang : Shortening import identifier
+12.3k Android Studio : Highlight ImageButton when pressed on example
+5.8k Golang : Dealing with backquote
+19.7k Golang : Convert seconds to human readable time format example
+19.2k Golang : How to Set or Add Header http.ResponseWriter?
+5.6k Golang : Denco multiplexer example
+5.6k Facebook : How to force facebook to scrape latest URL link data?
+11.3k Golang : Secure file deletion with wipe example
+9.5k PHP : Get coordinates latitude/longitude from string