@alexander-abakumov is correct. When allowUnlisted=false
, one must include the provided xml (<add fileExtension="." allowed="true" />
) to allow extension-less requests (e.g. /App/
or /Folder/
).
Request Filtering Limitations
You're correct to use URL Rewrite
for achieving RegEx pattern matching. Below are the limitations of Request Filtering.
- Stateless - Request Filtering has no knowledge of application or session state. Each request is processed individually regardless of whether a session has or has not been established.
- Request Header Only - Request Filtering can only inspect the request header. It has no visibility into the request body or any part of the response.
- Basic Logic - Regular expressions and wildcard matches are not available. Most settings consist of establishing size constraints while others perform simple string matching.
Still use Request Filtering
I would still recommend using Request Filtering since it operates so early in the IIS request pipeline; even before URL Rewrite. This gives you the opportunity to immediately discard bad requests. URL Rewrite can then be a second layer of request filtering.
IISRFBaseline
The information above is based on my PowerShell module IISRFBaseline. It helps establish an IIS Request Filtering baseline by leveraging Microsoft Logparser to scan a website's content directory and IIS logs.
For the fileExtensions
setting there are two methods for establishing a baseline:
- IIS Logs - by parsing prior successful requests and determining the extension of the request.
- Content Directory - scanning the file system of the website content directory to see what file extensions are in use.
There are caveats to these two approaches which are described in more detail here. With two techniques, a markdown file is provided describing the methodology of each as denoted by the suffix IIS
or FS
.
The result of these two techniques are combined, after removing bad requests, to create a baseline for this Request Filtering setting.