diff --git a/README.md b/README.md index 6068195..3e96c79 100644 --- a/README.md +++ b/README.md @@ -201,6 +201,11 @@ myhost.mydomain.com: healthcheck: false servers: - "127.0.0.1:8001" +DEFAULT: + paths: + "/": + servers: + - "127.0.0.1:3000" ``` **This means:** @@ -228,6 +233,7 @@ myhost.mydomain.com: - All requests to servers will require JWT token authentication (You can comment out the authorization to disable it), - Firs parameter specifies the mechanism of authorisation `jwt` - Second is the secret key for validating `jwt` tokens +- `DEFAULT` catch up everything else and proxy to `127.0.0.1:3000` --- diff --git a/src/web/proxyhttp.rs b/src/web/proxyhttp.rs index 3fd63f3..ee9b40d 100644 --- a/src/web/proxyhttp.rs +++ b/src/web/proxyhttp.rs @@ -290,5 +290,6 @@ fn return_header_host_from_upstream(session: &Session, ump_upst: &UpstreamsDashM let h = session.req_header().headers.get("host")?.to_str().ok()?; h.split_once(':').map_or(h, |(host, _)| host) }; - ump_upst.get(host_str).map(|entry| entry.key().clone()) + + ump_upst.get(host_str).or_else(|| ump_upst.get("DEFAULT")).map(|entry| entry.key().clone()) }