Commit graph

47 commits

Author SHA1 Message Date
spacewander
6c8e7aab73 document early_request_filter
Fix #363
---
updated

Includes-commit: 204ddb0274
Includes-commit: 34c67f0aca
Replicated-from: https://github.com/cloudflare/pingora/pull/368
Signed-off-by: spacewander <spacewanderlzx@gmail.com>
2024-09-13 14:11:24 -07:00
James Yang
2a4e152e80 fix(proxy): typo in example
Includes-commit: 9b1d7c544d
Replicated-from: https://github.com/cloudflare/pingora/pull/371
2024-09-13 14:11:24 -07:00
Edward Wang
96e561a999 Allow miss handler to lookup storage using streaming write tag
When supporting streaming partial writes, the cache miss request may not
always find the corresponding body reader for the storage asset that its
upstream write is trying to fill.

This change adds a lookup_streaming_write storage API and allows the
miss handler to provide a streaming write tag for use with the API, so
that it may find the matching hit handler to serve downstream.
2024-09-13 14:11:24 -07:00
Matthew Gumport
5e3e774a8d disable caching during error handling
This has the effect of reducing a warning log since we are not
leaving the lock dangling for the next reader.
2024-09-06 13:43:53 -07:00
Yuchen Wu
f3a5a85031 Windows support 1/n: clean up cargo and certain tests
Co-authored-by: Fredrik Enestad <fredrik@enestad.com>
2024-08-30 11:18:18 -07:00
Edward Wang
4f45792d80 Weaken or remove etags when downstream compression applies
Allow this as an adjustable setting to preserve etag when
(de)compressing. The default is to weaken etags whenever a compression
module applies.
2024-08-30 11:18:18 -07:00
Edward Wang
7003ac34ad Set stale-updating as an explicit CachePhase
This cache phase indicates when we are serving a stale cache hit, but
there is another request currently updating the asset.
2024-08-09 14:30:49 -07:00
Kevin Guthrie
76c4fdacbb Updating the rate-limiter documentation with a simpler example 2024-08-09 14:30:49 -07:00
Yuchen Wu
32303b9258 Address Rust 1.80 clippy warnings.
Also remove the doc_async_trait cfg since it is no longer viable.
2024-07-26 13:35:13 -07:00
Yuchen Wu
9f70abe97b Release 0.3.0 2024-07-12 11:24:29 -07:00
Yuchen Wu
9a68268da5 Add an example to create and import 3rd party modules 2024-07-12 11:24:29 -07:00
Yuchen Wu
cdefa5c431 Mark the error source from get_http_session()
Although it is implied that fail_to_connect() errors are already caused
by upstream connections, it is more clear for the user's code inside this callback
by marking the error source in this case.
2024-07-12 11:24:29 -07:00
Yuchen Wu
65b1d6c733 Invoke request_body_filter of modules for proxies 2024-07-12 11:24:29 -07:00
Yuchen Wu
62ddb7ebae Move adding ResponseCompression module logic to init_downstream_modules
So that users can override this behavior.
2024-06-28 12:34:25 -07:00
Wladimir Palant
dda7bec58c Added init_downstream_modules phase allowing modules to be set up before startup
Includes-commit: 1bf3d4dfea
Replicated-from: https://github.com/cloudflare/pingora/pull/284
2024-06-28 12:34:25 -07:00
Edward Wang
03bd29044e Always respect_keepalive when releasing http session
When a user calls `release_http_session` on an http Connector, it is
usually implied that they intend to reuse the underlying connection if
possible. Previously for H1 this involved reaching into the H1 client
Session and calling `respect_keepalive`. The new behavior always
respects keepalive as part of releasing the http session, as it was very
easy to overlook this step and unintentionally disable connection reuse
for H1 sessions.
2024-06-28 12:34:25 -07:00
Andrew Hauck
fbf3a95749 Add a write timeout to write body buf and an option to set a minimum send rate 2024-06-28 12:34:25 -07:00
Andrew Hauck
a1f1ad8a43 h2c support 2024-06-21 09:54:09 -07:00
Alex Severin
20cac2e673 expose new_uds err 2024-06-14 16:00:03 -07:00
Yuchen Wu
31d7b63ed7 Add new_h1() back
This function turns out to be actually useful for testing and mocking
2024-06-07 15:42:30 -04:00
Yuchen Wu
11863d27a2 Introduce HttpModules to pingora-proxy.
This feature allows to plug in 3rd party extensions with minimal code
required.

The downstream compression logic is now a module.

Add: a new early_request_filter API to fine tune the behavior of the modules.
Add: a few APIs to write the response with these modules enabled. This
should address issues like compression is not applied to custom
responses.
2024-06-07 15:42:30 -04:00
Yuchen Wu
fa071eb506 Refactor Service API: Arc is no longer needed for apps.
This change makes a bit cleaner to use the API. It also allows to
modify the application logic before starting the service.
2024-05-31 11:04:36 -07:00
Kevin Guthrie
9dee8e6775 Dropping the clap version to the most recent compatible with our rust 1.72 2024-05-24 10:00:06 -07:00
Wladimir Palant
795594db83 Fixes #235 - Replace unmaintained structopt crate by clap
---
Fixed formatting

Includes-commit: 05f9754166
Includes-commit: 29286c7e71
Replicated-from: https://github.com/cloudflare/pingora/pull/239
2024-05-24 10:00:06 -07:00
Zaidoon Abd Al Hadi
026f483712 expose session to cache_hit_filter phase 2024-05-24 10:00:06 -07:00
Yuchen Wu
f38f3b9a38 Add request body filter 2024-05-24 10:00:06 -07:00
Yuchen Wu
3dbdcc6b09 Release 0.2.0 2024-05-10 15:22:37 -07:00
Yuchen Wu
7507b69683 Fix clipper warning on Rust 1.78 2024-05-10 15:22:37 -07:00
Kevin Guthrie
1a6af266a0 cargo fmt 2024-05-10 15:22:37 -07:00
James Munns
880488987c Add Service<HttpProxy<T>> constructor for providing name
Includes-commit: 8727b2466f
Replicated-from: https://github.com/cloudflare/pingora/pull/218
2024-05-10 15:22:37 -07:00
ewang
cfb89c6eb5 Add purge_response callback
Allow generating custom responses to purge requests (requests to
invalidate or delete from the HTTP cache).
2024-05-10 15:22:37 -07:00
yaohuiming
42b0224129 Add async_cleanup() method to ServerApp trait
---
Refactor cleanup functions to use async/await

Includes-commit: 3cd52fee46
Includes-commit: 58946a8d58
Replicated-from: https://github.com/cloudflare/pingora/pull/193
2024-05-10 15:22:37 -07:00
Andrew Hauck
a6bd816f16 Add support for downstream h2 trailers and add an upstream h2 response trailer filter 2024-04-26 12:31:57 -04:00
Gustav Davidsson
2631da74b0 Vary examples 2024-04-26 12:31:57 -04:00
ewang
3f682ea37f Add cache_not_modified_filter, handle etag/last-modified
This filter allows customizing the `ETag`/`Last-Modified` check to see
if the proxy cache can return 304 Not Modified instead of the full
response.

Also flesh out the `ETag`/`Last-Modified` handling in the base
`not_modified_filter` with `If-None-Match` and `If-Modified-Since`.
2024-04-12 15:30:28 -07:00
Gustav Davidsson
881db9e32c Add/polish some comments 2024-04-05 11:46:20 -07:00
Yuchen Wu
dfcd3d1d9f Fix typos and grammar issues in docs
And other things.

Co-authored-by: DimanNe <causal.consistency@proton.me>
Co-authored-by: Xiaobo Liu <cppcoffee@gmail.com>
Co-authored-by: houseme <housemecn@gmail.com>
Co-authored-by: lilo <luolee.me@gmail.com>
Co-authored-by: Yang He <abruzzi.hraig@gmail.com>
2024-04-05 11:46:20 -07:00
afon
aca70af5e5 Only compile pingora-openssl when openssl feature is enabled.
Replicated-from: https://github.com/cloudflare/pingora/pull/131
Includes-commit: ae706cdf49
2024-04-05 11:46:20 -07:00
Yuchen Wu
cc32316980 Allow response body to be modified. 2024-04-05 11:46:20 -07:00
Andrew Hauck
5bb90dcd67 Add example that routes to LB cluster based on request uri 2024-04-05 11:46:20 -07:00
battmdpkq
8a84b24ad0 fix some comments
Signed-off-by: battmdpkq <cmaker@163.com>
Replicated-from: https://github.com/cloudflare/pingora/pull/123
Includes-commit: 943bedb281
2024-03-15 14:37:56 -07:00
ewang
20fd391f3e Add server_addr and client_addr to Session 2024-03-15 14:37:56 -07:00
Matthew Gumport
ae8ea771b1 compile and test cleanly with nightly
The vast majority of these are redundant imports.
2024-03-15 14:37:56 -07:00
ewang
8dc94d6cc4 More minor comment fixes and improvements 2024-03-01 13:47:27 -08:00
Yuchen Wu
8160ad1698 Fix typos and grammar issues
Co-authored-by: =?~~~?q?Ren=C3=A9=20Kla=C4=8Dan?= <rene@klacan.sk>
Co-authored-by: 12932 <68835423+12932@users.noreply.github.com>
Co-authored-by: Alessandro <aleferrara1998@gmail.com>
Co-authored-by: InImpasse <40639475+InImpasse@users.noreply.github.com>
Co-authored-by: Paul James Cleary <pauljamescleary@gmail.com>
Co-authored-by: Yang Hau <yuanyanghau@gmail.com>
Co-authored-by: Morpheus <40785143+Muzych@users.noreply.github.com>
Co-authored-by: mobeicanyue <81098819+mobeicanyue@users.noreply.github.com>
Co-authored-by: Twacqwq <69360546+Twacqwq@users.noreply.github.com>
Co-authored-by: Bobby <zkd8907@live.com>
Co-authored-by: Dup4 <lyuzhi.pan@gmail.com>
Co-authored-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
Co-authored-by: Sheldon <1415182877@qq.com>
Co-authored-by: houseme <housemecn@gmail.com>
Co-authored-by: ZhangIvan1 <zhang_ivan1@163.com>
Co-authored-by: GrahamQuan <33834833+GrahamQuan@users.noreply.github.com>
Co-authored-by: =?~~~?q?Cristian=20Paul=20Pe=C3=B1aranda=20Rojas?= <paul@kristianpaul.org>
Co-authored-by: Nathan Sit <nsit.earth@gmail.com>
Co-authored-by: David Lee <67067729+LordMoMA@users.noreply.github.com>
Co-authored-by: Mengliang Su <mengliang.su@shopee.com>
Co-authored-by: =?~~~?q?=EA=B9=80=EC=84=A0=EC=9A=B0?= <seonwoo960000@toss.im>
Co-authored-by: Allen Huang <huangseji@meituan.com>
Co-authored-by: Opacity <70315161+zreren@users.noreply.github.com>
Co-authored-by: cris <sqdcmk@gmail.com>
Co-authored-by: Killian Ye <40255385+ykw1129@users.noreply.github.com>
Co-authored-by: Jiwei-dev <hi.jiwei@gmail.com>
Co-authored-by: Jinfeng Wang <41931794+wjf40390@users.noreply.github.com>
Co-authored-by: Ikko Eltociear Ashimine <eltociear@gmail.com>
2024-03-01 13:47:27 -08:00
ewang
e811382224 Run upstream_response_filter on 304 from upstream cache revalidation
Previously only the response_filter would run on revalidated responses
with no way to process the upstream 304.
Also avoid passing through upstream 304 on revalidate
response_cache_filter errors and instead serve from cache. This
simplifies this edge case because it saves us from needing to check
whether the upstream header filter already ran on the 304 later.
2024-03-01 13:47:27 -08:00
Yuchen Wu
8797329225 Release Pingora version 0.1.0
Co-authored-by: Andrew Hauck <ahauck@cloudflare.com>
Co-authored-by: Edward Wang <ewang@cloudflare.com>
2024-02-27 20:25:44 -08:00