Hide

YetaWF.Core Package Documentation

Display
Print

YetaWF2.Middleware.BlockRequestMiddleware Class

Middleware to block requests based on UserAgent and requested URL. The inspiration for this came from a ridiculous amount of bots scanning our sites for exploits. So many .php requests in general, wp-login.php in particular and then oh the bots scraping email addresses, like sleazoid zoominfobot which doesn't even honor rel=nofollow. Well given their reputation (google it), that's not surprising.

This middleware blocks requests by URL containing or ending in certain strings, and user agents that contain certain strings, all case insensitive. The configuration is provided via a JSON file, with a UI in Admin > Settings > Request Block Settings (standard YetaWF site), which can also dynamically reload the settings.

There is no logging as we don't care who the sleaze balls are.

Namespace: YetaWF2.Middleware
Assembly: YetaWF.Core

Inheritance

Syntax

public class BlockRequestMiddleware;

Constructors

PublicBlockRequestMiddlewareConstructor.

Properties

PublicStaticSettingsFile(not specified)

Fields

PublicStaticSETTINGSFILE(not specified)

Methods

PublicInherited from System.ObjectEqualsDetermines whether the specified object is equal to the current object.
ProtectedInherited from System.ObjectFinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
PublicStaticGetCurrentSettingsReturns the currently active settings.
PublicInherited from System.ObjectGetHashCodeServes as the default hash function.
PublicInherited from System.ObjectGetTypeGets the Type of the current instance.
PublicInvoke(not specified)
PublicStaticLoadBlockSettingsAsyncLoad or reload the block settings file.
ProtectedInherited from System.ObjectMemberwiseCloneCreates a shallow copy of the current Object.
PublicStaticInherited from System.ObjectReferenceEqualsDetermines whether the specified Object instances are the same instance.
PublicStaticSaveNewSettingsSave new settings.
PublicInherited from System.ObjectToStringReturns a string that represents the current object.

See Also YetaWF.Core Overview