gitea/routers/common
Rowan Bohde c57304ac3f
Add middleware for request prioritization (#33951)
This adds a middleware for overload protection that is intended to help protect against malicious scrapers.
It does this via [`codel`](https://github.com/bohde/codel), which will perform the following:

1. Limit the number of in-flight requests to some user-defined max
2. When in-flight requests have reached their begin queuing requests.
    Logged-in requests having priority above logged-out requests
3. Once a request has been queued for too long,
    it has a probabilistic chance to be rejected based on how overloaded the entire system is.

When a server experiences more traffic than it can handle,
this keeps latency low for logged-in users and rejects just
enough requests from logged-out users to not overload the service.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
2025-04-14 16:25:48 +02:00
..
actions.go Fix bug on downloading job logs (#34041) 2025-03-27 17:20:56 -07:00
auth.go Move context from modules to services (#29440) 2024-02-27 08:12:22 +01:00
blockexpensive_test.go Add a config option to block "expensive" pages for anonymous users (#34024) 2025-03-30 05:26:19 +00:00
blockexpensive.go Add a config option to block "expensive" pages for anonymous users (#34024) 2025-03-30 05:26:19 +00:00
codesearch.go Improve issue & code search (#33860) 2025-03-13 11:07:48 +08:00
compare.go feat(api): implement branch/commit comparison API (#30349) 2024-04-16 11:45:04 +08:00
db.go Enable addtional linters (#34085) 2025-04-01 10:14:01 +00:00
deadline.go Fix milestone deadline and date related problems (#32339) 2024-11-05 07:46:40 +00:00
errpage_test.go Use test context in tests and new loop system in benchmarks (#33648) 2025-02-20 09:57:40 +00:00
errpage.go Refactor cache-control (#33861) 2025-03-13 07:04:50 +08:00
lfs.go Fix LFS route mock, realm, middleware names (#32488) 2024-11-13 16:58:09 +08:00
markup.go Enable addtional linters (#34085) 2025-04-01 10:14:01 +00:00
middleware.go Support performance trace (#32973) 2025-01-21 18:57:07 +00:00
pagetmpl.go Prepare common tmpl functions in a middleware (#33957) 2025-03-25 06:17:58 +00:00
qos_test.go Add middleware for request prioritization (#33951) 2025-04-14 16:25:48 +02:00
qos.go Add middleware for request prioritization (#33951) 2025-04-14 16:25:48 +02:00
redirect.go Refactor AppURL usage (#30885) 2024-05-07 08:26:13 +00:00
serve.go Refactor cache-control (#33861) 2025-03-13 07:04:50 +08:00