feat(static_files): add static file serving, SPA fallback, rewrites, body rewriting, and auth subrequests
Add static file serving with try_files chain ($uri, $uri.html, $uri/index.html, fallback), regex-based URL rewrites compiled at startup, response body find/replace for text/html and JS content, auth subrequests with header capture for path routes, and custom response headers per route. Extends RouteConfig with static_root, fallback, rewrites, body_rewrites, and response_headers fields. Signed-off-by: Sienna Meridian Satterwhite <sienna@sunbeam.pt>
This commit is contained in:
@@ -342,6 +342,9 @@ fn run_serve(upgrade: bool) -> Result<()> {
|
||||
// Pingora's async proxy calls without cross-runtime waker concerns.
|
||||
let acme_routes: acme::AcmeRoutes = Arc::new(RwLock::new(HashMap::new()));
|
||||
|
||||
let compiled_rewrites = SunbeamProxy::compile_rewrites(&cfg.routes);
|
||||
let http_client = reqwest::Client::new();
|
||||
|
||||
let proxy = SunbeamProxy {
|
||||
routes: cfg.routes.clone(),
|
||||
acme_routes: acme_routes.clone(),
|
||||
@@ -349,6 +352,8 @@ fn run_serve(upgrade: bool) -> Result<()> {
|
||||
scanner_detector,
|
||||
bot_allowlist,
|
||||
rate_limiter,
|
||||
compiled_rewrites,
|
||||
http_client,
|
||||
};
|
||||
let mut svc = http_proxy_service(&server.configuration, proxy);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user