@@ -184,7 +184,7 @@ Add or modify request headers.
184184
185185``` caddy
186186localhost:8080 {
187- header X-Forwarded-For {remote_host }
187+ header X-Request-ID {uuid }
188188 header X-Custom-Header custom-value
189189 reverse_proxy backend:3000
190190}
@@ -253,7 +253,7 @@ localhost:8080 {
253253
254254``` caddy
255255localhost:8080 {
256- header X-Forwarded-For {remote_host }
256+ header X-Forwarded-For {header.X-Forwarded-For }
257257 header X-Request-ID {uuid}
258258 uri_replace /api /backend
259259 reverse_proxy http://backend:3000
@@ -278,63 +278,56 @@ Use placeholders in header values:
278278- ` {header.Name} ` - Value of request header with that name
279279- ` {env.VAR} ` - Value of environment variable
280280- ` {uuid} ` - Random UUID
281- - ` {remote_host} ` - Remote host (requires ` auth ` feature)
282281
283282## Features
284283
285284### Default Features
286285
287- - ` cli ` - Command-line interface support (enabled by default)
288- - ` tls ` - HTTPS backend support (enabled by default)
286+ - ` cli ` - Command-line interface support
287+ - ` tls ` - HTTPS backend support
288+ - ` api ` - Management API for runtime configuration
289289
290290### Optional Features
291291
292292``` toml
293+ # Minimal - core proxy only (for embedding in other applications)
294+ [dependencies ]
295+ tiny-proxy = { version = " 0.1" , default-features = false }
296+
297+ # With HTTPS backend support
298+ [dependencies ]
299+ tiny-proxy = { version = " 0.1" , default-features = false , features = [" tls" ] }
300+
301+ # With management API
293302[dependencies ]
294- tiny-proxy = { version = " 0.1" , features = [ " full " ] }
303+ tiny-proxy = { version = " 0.1" , default- features = false , features = [ " tls " , " api " ] }
295304
296- # Or select specific features
297- tiny-proxy = { version = " 0.1" , features = [" cli" , " tls" , " api" ] }
305+ # Full standalone (same as default)
306+ [dependencies ]
307+ tiny-proxy = { version = " 0.1" }
298308```
299309
300310#### ` cli ` (default)
301311
302312Enable CLI dependencies and ` tiny-proxy ` binary.
303313
304- #### ` auth `
305-
306- Authentication and authorization support:
307-
308- ``` rust
309- use tiny_proxy :: auth;
310-
311- // Validate token
312- let is_valid = auth :: validate_token (& req , " http://auth-service/validate" ). await ? ;
313-
314- // Process header substitutions
315- let value = auth :: process_header_substitution (" Bearer {header.Authorization}" , & req )? ;
316- ```
317-
318314#### ` tls ` (default)
319315
320316Enable HTTPS backend support using ` hyper-tls ` .
321317
322- #### ` api `
318+ #### ` api ` (default)
323319
324320Management API for runtime configuration:
325321
326322``` rust
327323use tiny_proxy :: api;
324+ use std :: sync :: Arc ;
328325use tokio :: sync :: RwLock ;
329326
330327let config = Arc :: new (RwLock :: new (Config :: from_file (" config.caddy" )? ));
331328api :: start_api_server (" 127.0.0.1:8081" , config ). await ? ;
332329```
333330
334- #### ` full `
335-
336- Enable all features (` cli ` , ` auth ` , ` api ` ).
337-
338331## API Documentation
339332
340333See the [ module documentation] ( https://docs.rs/tiny-proxy ) for detailed API reference.
@@ -418,17 +411,20 @@ tiny-proxy/
418411### Build with Features
419412
420413``` bash
421- # CLI only (default )
414+ # Default ( CLI + TLS + API )
422415cargo build
423416
424417# Library only (no CLI dependencies)
425418cargo build --no-default-features
426419
427- # Full features
428- cargo build --features full
420+ # Library with HTTPS support
421+ cargo build --no-default- features --features tls
429422
430- # Specific features
431- cargo build --features auth,api
423+ # Library with API for config management
424+ cargo build --no-default-features --features tls,api
425+
426+ # CLI without API
427+ cargo build --no-default-features --features cli,tls
432428```
433429
434430### Run Examples
@@ -439,9 +435,6 @@ cargo run --example basic
439435
440436# Background execution
441437cargo run --example background
442-
443- # Hot-reload (with auth feature)
444- cargo run --example hot_reload --features auth
445438```
446439
447440## Roadmap
0 commit comments