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
+5.8k Golang : Experimenting with the Rejang script
+10k Golang : Embed secret text string into binary(executable) file
+6.2k Golang : Handling image beyond OpenCV video capture boundary
+11.7k Golang : How to parse plain email text and process email header?
+20.8k Golang : For loop continue,break and range
+6.6k Golang : Get expvar(export variables) to work with multiplexer
+9.7k Golang : Function wrapper that takes arguments and return result example
+8.9k nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
+15k Golang : How to get Unix file descriptor for console and file
+5.5k List of Golang XML tutorials
+7.9k Golang : Variadic function arguments sanity check example
+16.5k Golang : Get the IPv4 and IPv6 addresses for a specific network interface