From 46c2f90f9287e08769e3d4a1d29a27d8bed67149 Mon Sep 17 00:00:00 2001 From: xfy Date: Thu, 26 Jun 2025 21:53:24 +0800 Subject: [PATCH] chore: update default config add lua script path --- config.example_full.toml | 17 ++++++++++++++--- src/http/reverse_proxy.rs | 1 - 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/config.example_full.toml b/config.example_full.toml index cfd4dc0..1b5069a 100644 --- a/config.example_full.toml +++ b/config.example_full.toml @@ -1,7 +1,7 @@ # Virtual host [[host]] ip = "0.0.0.0" -port = 4000 +port = 80 # Connection timeout timeout = 15 # SSL certificate @@ -21,7 +21,7 @@ location = "/" # Static file root # or proxy_pass # or redirect -root = "./html" +root = "html" # Only use for root field index = ["index.html"] # List directory @@ -36,10 +36,21 @@ status = 404 page = "404.html" # Reverse proxy +[[host]] +ip = "0.0.0.0" +port = 8080 [[host.route]] -location = "/proxy/" +location = "/" proxy_pass = "http://localhost:3000/" # Timeout for connect to upstream proxy_timeout = 10 # Client request max body size (bytes) max_body_size = 2048 + +# Lua script +[[host]] +ip = "0.0.0.0" +port = 8081 +[[host.route]] +location = "/" +lua_script = "html/index.lua" diff --git a/src/http/reverse_proxy.rs b/src/http/reverse_proxy.rs index 75b41d5..08cb6d9 100644 --- a/src/http/reverse_proxy.rs +++ b/src/http/reverse_proxy.rs @@ -188,7 +188,6 @@ pub async fn serve( // forward request body let body = req.into_body(); - // TODO: set body size limit let bytes = axum::body::to_bytes(body, 2048).await.map_err(|err| { tracing::error!("Failed to proxy request: {}", err); RouteError::InternalError()