Need some help in writing a rule to block the following request
The url in question is:
www.somesite.com/catalogsearch/result/?q=downloader
I have tried the following, but this does not work
location ^~ catalogsearch/result/?q=downloader {
deny all;
}
I "think" the because the ? question mark is included is treating the url as a query string??
Regards
If you want to block access through the parameter q=downloader
only at URL www.somesite.com/catalogsearch/result/ :
error_page 418 = @blockAccess;
location /catalogsearch/result {
if ($args ~* "q=downloader") {
return 418;
}
}
location @blockAccess {
deny all;
}
Add before
location /
If you want to block the q=downloader
parameter of all URL's, just put the code below before location
:
error_page 418 = @blockAccess;
if ($args ~* "q=downloader") {
return 418;
}
location @blockAccess {
deny all;
}
If you want to block the www.somesite.com/catalogsearch/result/ :
error_page 418 = @blockAccess;
# Add before "location /"
location /catalogsearch/result {
return 418;
}
location @blockAccess {
deny all;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.