when throttling is active, in addition to front-end pages, ACT requests returning json packets are also throttled.
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 50/100
Direzione di ricerca
Start by reading the throttling guard around line 340 of system/ee/libraries/Core.php, which currently excludes REQ == 'CP', and the banish() method in system/ee/libraries/Throttling.php that builds the current plain-text/404/redirect response. Reproduce with a low max_page_loads/time_interval pair, then hit an ACT endpoint with X-Requested-With: XMLHttpRequest to see the non-JSON body. Decide between the two proposed fixes on the thread — the simpler REQ == 'ACTION' && AJAX_REQUEST exclusion in Core.php, or a JSON 429 response in banish() — and verify AJAX-driven control panel elements no longer break; done means an AJAX ACT call gets a usable response instead of plain text.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Description of the problem
ExpressionEngine throttling currently applies to ACT requests and appears to return responses intended for normal page requests (plain text/redirect/404), even when the request is AJAX and expects JSON.
This causes AJAX driven elements in CP pages to fail when throttling is triggered.
This in turn causes problems for some add-ons (e.g. JCOGS Image Pro) that use ACT based AJAX requests to generate dynamic parts of some control panel pages.
A better response would be either for throttling to return an API-safe response to AJAX/JSON-accepting requests, or to simply allow ACT based AJAX requests to run.
How To Reproduce
Steps to reproduce the behaviour:
- Enable throttling in EE settings.
- Configure low values (example):
max_page_loads = 2time_interval = 5lockout_time = 30
- Call an
ACTendpoint repeatedly using AJAX (X-Requested-With: XMLHttpRequest) expecting JSON. - Observe that after threshold is exceeded, response body is plain text/404/redirect style rather than JSON.
Error Messages
Plaintext:"You have exceeded the allowed page load frequency."
Environment Details:
- Version: 7.5.21
- PHP Version 8.2.30.
Possible Solution
It appears that the throttling code makes no attempt to identify AJAX requests.
- One solution would be to modify the
banish()method insystem/ee/libraries/Throttling.phpto include a check to see if call being processed is both an ACT request (REQ='ACTION')and an AJAX request (AJAX_REQESTdefined) and use this to generate a fourth type of output with appropriate HTTP headers and message body ... for example:- HTTP
429 Too Many Requests Content-Type: application/json; charset=utf-8- JSON body with a stable error shape such as:
- HTTP
{
"status": "error",
"error": "Request throttled. Please try again later.",
"error_code": "throttled"
}
- A second (better, and easier) solution would be to exclude AJAX based ACT from throttling - along lines of current exclusion of CP activities by changing the conditional on line 340 of
system/ee/libraries/Core.phpto includeREQ='ACTION'andAJAX_REQEST- e.g.if (REQ != 'CP' && ! (REQ == 'ACTION' && AJAX_REQUEST)) {
- Lingua principale
- PHP
- Stelle
- 505
- Fork
- 135
- Merge medio
- 3g 7h
- PR unite (30g)
- 7
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ExpressionEngine/ExpressionEngine
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
ExpressionEngine/ExpressionEngine#5453 ·
I maintainer di solito rispondono entro 1 giorno
-
RTE Custom Stylesheet causes warning: Trying to access array offset on value of type boolForse già presa @Yulyaswan l’ha presa 10 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
ExpressionEngine/ExpressionEngine#5406 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 62/100
ExpressionEngine/ExpressionEngine#5381 ·
I maintainer di solito rispondono entro 1 giorno
-
Bug: Accepted
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
ExpressionEngine/ExpressionEngine#5117 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
ExpressionEngine/ExpressionEngine#5066 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di ExpressionEngine/ExpressionEngine
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
Automattic/blocks-engine#4621 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
YunoHost-Apps/snappymail_ynh#205 ·
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
Automattic/static-site-importer#2653 ·
I maintainer di solito rispondono entro 1 giorno
-
Bug (unconfirmed) Search :mag:
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
FreshRSS/FreshRSS#9533 · 1 reazione ·
I maintainer di solito rispondono entro 1 giorno
-
🏁 status: ready for work 💻 aspect: code 🛠 goal: fix 🟨 priority: medium
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100