techimprovement/module-rate-limit

N/A

Installs: 1

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 0

Forks: 0

Open Issues: 0

Type:magento2-module

1.0.0 2024-02-18 02:53 UTC

This package is auto-updated.

Last update: 2024-09-18 04:13:24 UTC


README

Module Overview

The TechImprovement_RateLimit module for Magento 2 provides functionality to limit the rate of requests to the Magento site, which can help prevent abuse or excessive load on the server. It allows whitelisting and blacklisting of IP addresses, logging of rate-limiting events, and exemption of known good bots from rate limiting.

Features

  • Enable or disable rate limiting.
  • Configure the maximum number of requests allowed and the time period for rate limiting.
  • Whitelist IPs to exclude from rate limiting.
  • Blacklist IPs to always deny access.
  • Enable logging for rate limiting events and configure log cleaning schedule.
  • Exempt known good bots from rate limiting.

Installation

Via Composer

  1. Add the module's repository to your Magento project's composer.json file (if it is hosted on a repository).
  2. Run composer require techimprovement/rate-limit to add the module to your project.
  3. Enable the module by running php bin/magento module:enable TechImprovement_RateLimit.
  4. Run php bin/magento setup:upgrade to install the module.
  5. Deploy static content (if necessary) with php bin/magento setup:static-content:deploy.

Manually

  1. Create the following directory structure in your Magento installation: app/code/TechImprovement/RateLimit.
  2. Upload the module files to the newly created directory.
  3. Run php bin/magento module:enable TechImprovement_RateLimit from the Magento root directory.
  4. Run php bin/magento setup:upgrade to install the module.
  5. Deploy static content (if necessary) with php bin/magento setup:static-content:deploy.

Configuration

  1. Navigate to the Magento Admin Panel.
  2. Go to Stores > Configuration > TechImprovement > Rate Limit.
  3. Configure the settings as needed:
    • Enable rate limiting and logging.
    • Set maximum requests and time period.
    • Manage whitelist and blacklist IPs.
    • Choose the known bots exemption status.
    • Configure log cleaning schedule.
  4. Save the configuration.

Usage

After configuring the module, it will automatically start to limit the rate of requests based on the specified settings. Whitelisted IP addresses will bypass rate limiting, while blacklisted IPs will be denied access. Known bots can either be exempted or subject to rate limiting based on the configuration.

The module will log rate-limiting events if logging is enabled. You can view these logs in the specified log file (by default var/log/rate_limit.log). A cron job will clean the log file according to the schedule set in the configuration.

Enable/Disable Module

To enable or disable the module, use the following CLI commands:

  • Enable: php bin/magento module:enable TechImprovement_RateLimit
  • Disable: php bin/magento module:disable TechImprovement_RateLimit

After enabling or disabling, always run php bin/magento setup:upgrade and clear the cache.

Support

For any issues or questions regarding the module, please contact support at info@techimprovement.net.

Author

This module is brought to you by TechImprovement Inc, a provider of Magento extensions and custom eCommerce solutions.

Support Our Project

If you find this project helpful, consider supporting us with a donation by clicking this button or scan the QR code below:

Donate QR Code