AWS WAF Blocks Media Library AJAX Pagination URLs

Created on 13 February 2024, 9 months ago
Updated 15 February 2024, 9 months ago

Problem/Motivation

In Drupal 9.5.11, the Media Library AJAX pagination used the POST method. In Drupal 10.1.x, it switched to using the GET method.
With multiple pages in the Media Library, the URLs for these pages become longer and longer. Consequently, these lengthy URLs are being blocked by AWS WAF when following the core ruleset https://docs.aws.amazon.com/waf/latest/developerguide/aws-managed-rule-g...
---
SizeRestrictions_QUERYSTRING
Inspects for URI query strings that are over 2,048 bytes.
Rule action: Block
Label: awswaf:managed:aws:core-rule-set:SizeRestrictions_QueryString
--
The specific rule causing the block is the "SizeRestrictions_QUERYSTRING" rule, which checks for URI query strings over 2,048 bytes and blocks them accordingly.

This issue is related to
- Compress ajax_page_state https://www.drupal.org/project/drupal/issues/3348789 πŸ“Œ Compress ajax_page_state Fixed
- Extremely long Views AJAX query string triggers 403 in AWS https://www.drupal.org/project/drupal/issues/3380486 πŸ’¬ Extremely long Views AJAX query string triggers 403 in AWS Postponed: needs info

Despite applying a patch to compress libraries in the AjaxPageState https://www.drupal.org/project/drupal/issues/3348789#comment πŸ“Œ Compress ajax_page_state Fixed the URL length remains too large. The URL length was reduced from approximately 2600 to 2200 characters, and it still triggers blocks by AWS WAF.

This issue may also be connected to the discussion on allowing AJAX to use GET requests https://www.drupal.org/project/drupal/issues/956186 πŸ“Œ Allow AJAX to use GET requests Fixed

Proposed resolution

A question/suggestion arises: Wouldn't it be better to handle view ajax pagination with the POST method to avoid such URL length issues altogether?

πŸ’¬ Support request
Status

Active

Version

10.1 ✨

Component
ViewsΒ  β†’

Last updated 1 day ago

Created by

πŸ‡©πŸ‡ͺGermany vesnag

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Production build 0.71.5 2024