359 lines
7.9 KiB
JSON
359 lines
7.9 KiB
JSON
{
|
|
"listeners": {
|
|
"endpoints": [
|
|
{
|
|
"id": "http",
|
|
"name": "HTTP",
|
|
"scope": "public",
|
|
"enabled": true,
|
|
"binding": {
|
|
"address": "0.0.0.0:80",
|
|
"tls": false,
|
|
"http2": false
|
|
}
|
|
},
|
|
{
|
|
"id": "https",
|
|
"name": "HTTPS",
|
|
"scope": "public",
|
|
"enabled": true,
|
|
"binding": {
|
|
"address": "0.0.0.0:443",
|
|
"tls": true,
|
|
"http2": true,
|
|
"http3": {}
|
|
}
|
|
}
|
|
]
|
|
},
|
|
"tls": {
|
|
"default_certificate": "app",
|
|
"certificates": [
|
|
{
|
|
"id": "app",
|
|
"hosts": [
|
|
"app.example.com",
|
|
"www.app.example.com"
|
|
],
|
|
"cert_file": "app.pem",
|
|
"key_file": "app.key"
|
|
}
|
|
]
|
|
},
|
|
"cache": {
|
|
"enabled": true,
|
|
"max_bytes": 536870912,
|
|
"max_object_bytes": 16777216,
|
|
"max_entries": 16384,
|
|
"cold_enabled": true,
|
|
"cold_path": "cache/cold",
|
|
"cold_max_bytes": 10737418240,
|
|
"cold_max_entries": 100000,
|
|
"default_ttl_seconds": 0,
|
|
"max_ttl_seconds": 86400,
|
|
"varnish_grace_seconds": 60,
|
|
"bypass_prefixes": [
|
|
"/api/",
|
|
"/admin/",
|
|
"/login"
|
|
],
|
|
"static_ignore_cookies": true,
|
|
"collapse_enabled": true,
|
|
"stale_if_error_timeout": true,
|
|
"stale_if_error_connection": true,
|
|
"stale_if_error_statuses": [
|
|
500,
|
|
502,
|
|
503,
|
|
504
|
|
],
|
|
"expose_status": true,
|
|
"rules": [
|
|
{
|
|
"id": "strip-tracking",
|
|
"name": "Ignore tracking parameters",
|
|
"enabled": true,
|
|
"stage": "request",
|
|
"match": "all",
|
|
"conditions": [],
|
|
"actions": [
|
|
{
|
|
"type": "strip_query",
|
|
"params": [
|
|
"utm_*",
|
|
"fbclid",
|
|
"gclid",
|
|
"msclkid",
|
|
"_ga"
|
|
]
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "static-30d",
|
|
"name": "Static files: 30 days in cache and browser",
|
|
"enabled": true,
|
|
"stage": "response",
|
|
"match": "all",
|
|
"conditions": [
|
|
{
|
|
"field": "extension",
|
|
"operator": "equals",
|
|
"values": [
|
|
"css",
|
|
"js",
|
|
"mjs",
|
|
"woff2",
|
|
"woff",
|
|
"svg",
|
|
"png",
|
|
"jpg",
|
|
"jpeg",
|
|
"webp",
|
|
"avif",
|
|
"ico"
|
|
]
|
|
}
|
|
],
|
|
"actions": [
|
|
{
|
|
"type": "ttl",
|
|
"seconds": 2592000
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "static-browser",
|
|
"name": "Browser cache for static files",
|
|
"enabled": true,
|
|
"stage": "deliver",
|
|
"match": "all",
|
|
"conditions": [
|
|
{
|
|
"field": "extension",
|
|
"operator": "equals",
|
|
"values": [
|
|
"css",
|
|
"js",
|
|
"mjs",
|
|
"woff2",
|
|
"woff",
|
|
"svg",
|
|
"png",
|
|
"jpg",
|
|
"jpeg",
|
|
"webp",
|
|
"avif",
|
|
"ico"
|
|
]
|
|
}
|
|
],
|
|
"actions": [
|
|
{
|
|
"type": "default_header",
|
|
"name": "Cache-Control",
|
|
"value": "public, max-age=2592000"
|
|
}
|
|
]
|
|
},
|
|
{
|
|
"id": "hide-powered-by",
|
|
"name": "Hide X-Powered-By",
|
|
"enabled": true,
|
|
"stage": "deliver",
|
|
"match": "all",
|
|
"conditions": [],
|
|
"actions": [
|
|
{
|
|
"type": "remove_header",
|
|
"name": "X-Powered-By"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
},
|
|
"compression": {
|
|
"gzip": true,
|
|
"br": true,
|
|
"zstd": true,
|
|
"deflate": false,
|
|
"min_bytes": 1024
|
|
},
|
|
"logging": {
|
|
"file": {
|
|
"enabled": true,
|
|
"path": "/var/log/rustproxy/access.jsonl",
|
|
"per_vhost": false,
|
|
"directory": "/var/log/rustproxy/vhosts"
|
|
}
|
|
},
|
|
"prometheus": {
|
|
"enabled": true,
|
|
"listen": "127.0.0.1:9191",
|
|
"path": "/metrics",
|
|
"allowed_cidrs": [
|
|
"127.0.0.0/8",
|
|
"10.0.0.0/8"
|
|
],
|
|
"bearer_token_env": "RUSTPROXY_METRICS_TOKEN"
|
|
},
|
|
"vhosts": [
|
|
{
|
|
"id": "app",
|
|
"websockets": true,
|
|
"force_ssl": true,
|
|
"forward_client_ip": true,
|
|
"frontend": {
|
|
"hosts": [
|
|
"app.example.com",
|
|
"www.app.example.com"
|
|
]
|
|
},
|
|
"www_redirect": true,
|
|
"www_redirect_target": "app.example.com",
|
|
"backends": [
|
|
{
|
|
"id": "app-1",
|
|
"url": "http://10.0.0.11:3001",
|
|
"allow_private": true,
|
|
"protocol": "http1"
|
|
},
|
|
{
|
|
"id": "app-2",
|
|
"url": "http://10.0.0.12:3001",
|
|
"allow_private": true,
|
|
"protocol": "http1"
|
|
},
|
|
{
|
|
"id": "app-3",
|
|
"url": "http://10.0.0.13:3001",
|
|
"allow_private": true,
|
|
"protocol": "http1"
|
|
},
|
|
{
|
|
"id": "app-4",
|
|
"url": "http://10.0.0.14:3001",
|
|
"allow_private": true,
|
|
"protocol": "http1"
|
|
},
|
|
{
|
|
"id": "app-5",
|
|
"url": "http://10.0.0.15:3001",
|
|
"allow_private": true,
|
|
"protocol": "http1"
|
|
},
|
|
{
|
|
"id": "app-6",
|
|
"url": "http://10.0.0.16:3001",
|
|
"allow_private": true,
|
|
"protocol": "http1"
|
|
},
|
|
{
|
|
"id": "app-7",
|
|
"url": "http://10.0.0.17:3001",
|
|
"allow_private": true,
|
|
"protocol": "http1"
|
|
},
|
|
{
|
|
"id": "app-8",
|
|
"url": "http://10.0.0.18:3001",
|
|
"allow_private": true,
|
|
"protocol": "http1"
|
|
},
|
|
{
|
|
"id": "app-9",
|
|
"url": "http://10.0.0.19:3001",
|
|
"allow_private": true,
|
|
"protocol": "http1"
|
|
},
|
|
{
|
|
"id": "app-10",
|
|
"url": "http://10.0.0.20:3001",
|
|
"allow_private": true,
|
|
"protocol": "http1"
|
|
}
|
|
],
|
|
"load_balancing": {
|
|
"algorithm": "least_connections",
|
|
"health_check": {
|
|
"mode": "http",
|
|
"path": "/health",
|
|
"interval_ms": 5000,
|
|
"timeout_ms": 2000,
|
|
"fall": 2,
|
|
"rise": 1,
|
|
"expected_status_min": 200,
|
|
"expected_status_max": 299
|
|
},
|
|
"passive_health": {
|
|
"enabled": true
|
|
},
|
|
"keepalive": {
|
|
"enabled": true,
|
|
"idle_timeout_seconds": 60,
|
|
"max_idle_per_host": 32
|
|
},
|
|
"retry": {
|
|
"max_retries": 1,
|
|
"retry_connect_errors": true,
|
|
"retry_timeouts": false,
|
|
"retry_statuses": [
|
|
502,
|
|
503
|
|
]
|
|
}
|
|
},
|
|
"proxy_timeouts": {
|
|
"connect_timeout_seconds": 3,
|
|
"response_header_timeout_seconds": 120,
|
|
"read_timeout_seconds": 300,
|
|
"send_timeout_seconds": 300
|
|
},
|
|
"cache": {
|
|
"enabled": true
|
|
},
|
|
"security_headers": {
|
|
"hsts": {
|
|
"enabled": true,
|
|
"max_age_seconds": 31536000,
|
|
"include_subdomains": false,
|
|
"preload": false
|
|
},
|
|
"nosniff": true,
|
|
"frame_options": "sameorigin",
|
|
"referrer_policy": "strict-origin-when-cross-origin"
|
|
},
|
|
"rate_limit": {
|
|
"enabled": true,
|
|
"requests": 600,
|
|
"window_seconds": 60,
|
|
"burst": 120
|
|
},
|
|
"routes": [
|
|
{
|
|
"id": "admin",
|
|
"path_prefix": "/admin",
|
|
"cache": false,
|
|
"acl": {
|
|
"default": "deny",
|
|
"rules": [
|
|
{
|
|
"network": "10.0.0.0/8",
|
|
"action": "allow"
|
|
},
|
|
{
|
|
"network": "192.168.0.0/16",
|
|
"action": "allow"
|
|
}
|
|
]
|
|
}
|
|
},
|
|
{
|
|
"id": "api",
|
|
"path_prefix": "/api",
|
|
"cache": false
|
|
}
|
|
]
|
|
}
|
|
]
|
|
} |