1

Is this possible to block a requests ends with a specific url in apache, for example i have to block all the requests end with ?wsdl.

Bright
  • 50
  • 1
  • 9

1 Answers1

0

Your example is easy to solve, you can use mod_rewrite to achieve this:

RewriteCond     %{QUERY_STRING} "^wsdl.*$"
RewriteRule     "" "-" [F]

This will block any request with wsdl at the beginning of the first query parameter name.

To block only the wsdl parameter anywhere in the query string, the regular expression is a bit more complicated:

RewriteCond     %{QUERY_STRING} ".*(?:^|&)wsdl(?:=|&|$)"
RewriteRule     "" "-" [F]

This configuration works on

  • ?wsdl
  • ?wsdl=something
  • ?s1=s2&wsdl
  • ?s1=s2&wsdl=something
  • ?s1=s2&wsdl&s3=s4

Sources I've used: