This commit is contained in:
Andras Schmelczer 2026-07-03 18:01:10 +01:00
parent c2070693fb
commit 909e241907
55 changed files with 594 additions and 223 deletions

View file

@ -22,7 +22,7 @@ fn is_allowed_pb_path(path: &str) -> bool {
) {
return true;
}
// Prefix-allowed paths. The trailing slash is intentional — without it,
// Prefix-allowed paths. The trailing slash is intentional. Without it,
// `/api/collections/users` (the schema endpoint) would match.
const ALLOWED_PREFIXES: &[&str] = &[
"/api/collections/users/",
@ -34,7 +34,7 @@ fn is_allowed_pb_path(path: &str) -> bool {
.any(|prefix| path.starts_with(prefix))
}
/// Dedicated HTTP client for proxying does not follow redirects so 3xx
/// Dedicated HTTP client for proxying: does not follow redirects so 3xx
/// responses are passed through to the browser (needed for OAuth flows).
/// No client-wide timeout because SSE (Server-Sent Events) connections used
/// by PocketBase realtime/OAuth2 are long-lived streams; non-realtime
@ -132,7 +132,7 @@ pub async fn proxy_to_pocketbase(
// Stream the response body instead of buffering it entirely.
// This is critical for SSE (Server-Sent Events) used by PocketBase's
// realtime system and OAuth2 flow buffering would hang forever
// realtime system and OAuth2 flow: buffering would hang forever
// since SSE responses never complete.
let body = Body::from_stream(upstream.bytes_stream());
response.body(body).unwrap_or_else(|err| {