HttpWard Configuration Examples¶
Use this page when you want ready-to-adapt YAML snippets. For the full field-by-field reference, go back to Configuration.
Table of Contents¶
- Minimal reverse proxy
- TLS listener
- Static files
- Redirect
- Inline route strategy
- Disable inherited middleware
- Examples from this repository
Minimal reverse proxy¶
httpward.yaml¶
domain: example.com
listeners:
- port: 80
strategy: "default"
sites_enabled: ./sites-enabled
routes:
- match:
path: "/"
backend: "http://127.0.0.1:3000"
TLS listener¶
HTTPS with self-signed certificate¶
listeners:
- port: 443
tls:
self_signed: true
Static files¶
Serve a directory¶
routes:
- match:
path: "/assets/{*path}"
static_dir: "C:/www/assets/{*path}"
Redirect¶
Move one path permanently¶
routes:
- match:
path: "/old"
redirect:
to: "https://example.com/new"
code: 301
Inline route strategy¶
Inline middleware on a single route¶
routes:
- match:
path: "/api/{*path}"
backend: "http://127.0.0.1:8080/{*path}"
strategy:
- rate_limit:
requests: 50
window: "1m"
- logging:
level: info
Disable inherited middleware¶
Turn one middleware off locally¶
strategy:
- logging: off
Examples from this repository¶
Current httpward.yaml¶
# httpward.yaml - Fixed version with correct YAML indentation
log:
level: "info"
domain: global.local
strategy: default2
listeners:
- port: 444
tls:
self_signed: true
routes:
- match:
path: "/my/{*any}"
backend: "http://zerex222.ru:8080/{*any}"
- match:
path: "/site/{*path}"
static_dir: "C:/myprojects/html/{*path}"
- match:
path: "/search/{request}"
redirect:
to: "https://www.google.com/search?q={request}"
sites_enabled: "./sites-enabled"
strategies:
default2:
- httpward_log_module:
show_request: true
log_client_ip: true
log_current_site: true
log_route_info: true
log_response_status: true
Current strategies.yml¶
# HttpWard Strategies Configuration
# This file defines reusable middleware strategies that can be applied at different levels
# Default strategy applied globally
default:
- rate_limit:
requests: 1000
window: "1m"
- logging:
level: info
# For super safe mode
super-safe:
- rate_limit:
requests: 10
window: "1m"
- logging:
level: info
Current sites-enabled/example.com.yaml¶
domains: ["test.local", "*.test2.local"]
listeners:
- port: 777
- port: 443
tls:
self_signed: true
strategy: default55
routes:
- match:
path: "/api"
backend: "http://127.0.0.1:8080"
- match:
path: "/site/{*path}"
static_dir: "C:/myprojects/html/{*path}"
- match:
path: "/aaa/{id}"
backend: "http://127.0.0.1:3000/api/{id}"
strategies:
default55:
- httpward_log_module:
level: error
format: crazy