chore: update default config

add lua script path
This commit is contained in:
xfy
2025-06-26 21:53:24 +08:00
parent 64a85dd5a4
commit 46c2f90f92
2 changed files with 14 additions and 4 deletions

View File

@ -1,7 +1,7 @@
# Virtual host # Virtual host
[[host]] [[host]]
ip = "0.0.0.0" ip = "0.0.0.0"
port = 4000 port = 80
# Connection timeout # Connection timeout
timeout = 15 timeout = 15
# SSL certificate # SSL certificate
@ -21,7 +21,7 @@ location = "/"
# Static file root # Static file root
# or proxy_pass # or proxy_pass
# or redirect # or redirect
root = "./html" root = "html"
# Only use for root field # Only use for root field
index = ["index.html"] index = ["index.html"]
# List directory # List directory
@ -36,10 +36,21 @@ status = 404
page = "404.html" page = "404.html"
# Reverse proxy # Reverse proxy
[[host]]
ip = "0.0.0.0"
port = 8080
[[host.route]] [[host.route]]
location = "/proxy/" location = "/"
proxy_pass = "http://localhost:3000/" proxy_pass = "http://localhost:3000/"
# Timeout for connect to upstream # Timeout for connect to upstream
proxy_timeout = 10 proxy_timeout = 10
# Client request max body size (bytes) # Client request max body size (bytes)
max_body_size = 2048 max_body_size = 2048
# Lua script
[[host]]
ip = "0.0.0.0"
port = 8081
[[host.route]]
location = "/"
lua_script = "html/index.lua"

View File

@ -188,7 +188,6 @@ pub async fn serve(
// forward request body // forward request body
let body = req.into_body(); let body = req.into_body();
// TODO: set body size limit
let bytes = axum::body::to_bytes(body, 2048).await.map_err(|err| { let bytes = axum::body::to_bytes(body, 2048).await.map_err(|err| {
tracing::error!("Failed to proxy request: {}", err); tracing::error!("Failed to proxy request: {}", err);
RouteError::InternalError() RouteError::InternalError()