Web Connection
How to handle mis-behaving bots
Gravatar is a globally recognized avatar based on your email address. How to handle mis-behaving bots
  Eddie Caldwell
  All
  Apr 18, 2021 @ 11:22pm

To handle mis-behaving bots I handle them with the simple code below, which works pretty well but it seems to be filling the requestlog with hits showing as taking over 10 seconds to process. Other than setting the requestlog to only save errors, is there a better way to handle this so it doesn't fill the requestlog with hits that appear to take a long time?

In wwstore::onprocessinit

if throttle()
   response.status = [429 Too Many Requests]
   response.end()
   nodefault
   retu .f.
   endif

Thanks in advance for any suggestions!!

Gravatar is a globally recognized avatar based on your email address. re: How to handle mis-behaving bots
  Rick Strahl
  Eddie Caldwell
  Apr 19, 2021 @ 03:43pm

Where are you doing this check?

You should be doing this in OnProcessInit() to avoid running your actual requests.

Another option is this: Don't do it in FoxPro, but write a small .NET HttpModule that scans incoming requests for bots. If you can identify the bots (based on URLs or headers) then you can filter these requests out before they ever get to Web Connection which is much more efficient.

If you search around you might actually find some code for this. ASP.NET can work with code that's simply placed in a specific folder so no explicit compilation is required.

+++ Rick ---

© 1996-2021