Ingress Configuration
Ingress files are located in the config directory under CONFIG_ROOT/ingress.d/*.hcl.
An ingress configuration file defines the ingress rules for a particular bound address.
bind = { interface = "127.0.0.1" port = 8443 enable_http2 = true
tls = { cert = "/path/to/certs/server.pem" key = "/path/to/certs/server.key" }
connection_filter = { cidr = { allow = [] deny = [ "10.0.0.0/8", "192.168.0.0/16" ] }
ip_family = { ipv4 = true ipv6 = false }
on_no_peer_addr = "allow" # allow | deny }
connection_rate_limiting_filter = { max_connections_per_second = 10 window_seconds = 3 }}Top-level Options
Section titled “Top-level Options”interface
Section titled “interface”Type: string
Default: none
This is the interface to bind to.
Type: integer
Default: none
This is the port to bind to, on the specified interface.
enable_http2
Section titled “enable_http2”Type: boolean
Default: false
Enable HTTP/2 on the ingress instance. This has ramifications for TLS configuration (TLS is required) and other settings where noted.
Connection Filter (connection_filter)
Section titled “Connection Filter (connection_filter)”Snakeway supports filtering connections based on their source IP address.
Type: object
Default: none
The cidr block allows you to specify a list of CIDR blocks to allow or deny connections from.
Type: list(string)
Default: []
CIDR blocks to allow connections from. If empty, all connections are allowed.
Type: list(string)
Default: []
CIDR blocks to deny connections from. If empty, no connections are denied.
ip_family
Section titled “ip_family”Type: object
Default: none
Type: boolean
Default: false
If true, IPv4 connections are allowed.
Type: boolean
Default: false
If true, IPv6 connections are allowed.
on_no_peer_addr
Section titled “on_no_peer_addr”Type: string
Default: allow
Controls the behavior when a connection is made without a peer address. Default is permissive, i.e., any connection is allowed.
Rate Limiter (connection_rate_limiting_filter)
Section titled “Rate Limiter (connection_rate_limiting_filter)”Snakeway supports connection rate limiting at the bind level.
This filter applies soft, time-windowed admission control to new incoming connections on a per-client IP basis.
max_connections_per_second
Section titled “max_connections_per_second”Type: integer
Default: none
The maximum allowed average number of new connections per second, calculated over the configured time window.
window_seconds
Section titled “window_seconds”Type: integer
Default: none
The duration of the time window, in seconds, used to measure the connection rate.
Shorter windows react faster but allow more burstiness.
Longer windows react more slowly but provide smoother enforcement.
Admin Bind
Section titled “Admin Bind”Snakeway provides a built-in Admin API for observability and operational insight.
These endpoints are available on the bind_admin address under the /admin/ path.
bind_admin = { interface = "127.0.0.1" port = 8440 tls = { cert = "/path/to/certs/server.pem" key = "/path/to/certs/server.key" }}Services
Section titled “Services”An ingress configuration file may define zero or more services:
Example
Section titled “Example”services = [ { load_balancing_strategy = "round_robin"
health_check = { enable = false failure_threshold = 3 unhealthy_cooldown_seconds = 10 }
circuit_breaker = { enable_auto_recovery = false failure_threshold = 3 open_duration_milliseconds = 10000 half_open_max_requests = 1 success_threshold = 2 count_http_5xx_as_failure = false }
routes = [ { path = "/api" }, { path = "/ws" enable_websocket = true ws_max_connections = 10000 } ]
upstreams = [ { weight = 1 endpoint = { host = "127.0.0.1", port = 3443 } }, { weight = 1 endpoint = { host = "127.0.0.1", port = 3444 } }, { weight = 1 sock = "/tmp/snakeway-http-1.sock" } ] }]Top-level Options
Section titled “Top-level Options”Load Balancing Strategy
Section titled “Load Balancing Strategy”Type: string
Default: failover
Supported strategies:
failover: Always picks the first healthy upstream in the list.round_robin: Distributes requests evenly across upstreams.request_pressure: Picks the upstream with the lowest recent request pressure (heuristic-based, not transport-level).random: Picks a random healthy upstream.sticky_hash: Consistent hashing based on request characteristics.
Circuit Breaker
Section titled “Circuit Breaker”The circuit breaker protects your services by aggressively stopping traffic to failing upstreams.
enable
Section titled “enable”Type: boolean
Default: true
failure_threshold
Section titled “failure_threshold”Type: integer
Default: 5
Number of consecutive failures (transport errors or 5xx) in the Closed state before tripping the circuit to Open.
open_duration_milliseconds
Section titled “open_duration_milliseconds”Type: integer
Default: 10000 (10 seconds)
How long the circuit remains Open before transitioning to HalfOpen to allow probes.
half_open_max_requests
Section titled “half_open_max_requests”Type: integer
Default: 1
How many simultaneous probe requests are allowed while in the HalfOpen state.
success_threshold
Section titled “success_threshold”Type: integer
Default: 2
How many successful probes are required in HalfOpen to close the circuit again.
count_http_5xx_as_failure
Section titled “count_http_5xx_as_failure”Type: boolean
Default: true
Whether HTTP 5xx responses from the upstream count as failures for the circuit breaker.
Load Balancing Strategy
Section titled “Load Balancing Strategy”Type: string
Default: failover
Supported strategies:
failover: Always picks the first healthy upstream in the list.round_robin: Distributes requests evenly across upstreams.request_pressure: Picks the upstream with the lowest recent request pressure (heuristic-based, not transport-level).random: Picks a random healthy upstream.sticky_hash: Consistent hashing based on request characteristics.
Routes
Section titled “Routes”Type: string
Required: true
The URL path prefix to match. Must:
- start with
/ - be unique across all routes
enable_websocket
Section titled “enable_websocket”Type: boolean
Default: false
Enables WebSocket upgrades for this route.
ws_max_connections
Section titled “ws_max_connections”Type: integer
Optional
The maximum number of concurrent WebSocket connections allowed for this route.
Upstreams
Section titled “Upstreams”Each service can have one or more upstream servers defined. Upstreams represent the backend servers that will handle the proxied requests.
endpoint
Section titled “endpoint”Type: object
Required: false
The address of the upstream server: host, and port).
Example:
endpoint = { host = "10.0.0.1" port = 8080 }The protocol is inferred from the bind block’s TLS settings (no settings mean HTTP, TLS means HTTPS).
Type: string
Required: false
The local filesystem path to a Unix domain socket (e.g., /run/snakeway-http-1.sock).
weight
Section titled “weight”Type: integer
Default: 1
The weight of this upstream for load balancing strategies that support weighted distribution (i.e., round_robin).
Higher weights receive proportionally more traffic.
A weight of 10 will receive approximately 10 times more requests than a weight of 1.
Static Files
Section titled “Static Files”An ingress configuration file may define zero or more static file policies.
Example
Section titled “Example”static_files = [ { routes = [ { path = "/assets" file_dir = "/var/www/html" index = "index.html" directory_listing = false max_file_size = 10485760 // 10 MiB
compression = { enable_gzip = false small_file_threshold = 102400 // 100 KiB min_gzip_size = 1024 // 1 KiB enable_brotli = false min_brotli_size = 4096 }
cache_policy = { max_age_seconds = 60 public = true immutable = false } } ] }]Fields
Section titled “Fields”Type: string
Required: true
The URL path prefix to match.
file_dir
Section titled “file_dir”Type: string
Required: true
Absolute path to the directory on disk that will be served.
Constraints:
- must be an absolute path
- must exist
- must be a directory
- must not be
/
Type: string
Optional
Filename to serve when a directory is requested.
directory_listing
Section titled “directory_listing”Type: boolean
Default: false
Whether to enable directory listings when no index file is present.
max_file_size
Section titled “max_file_size”Type: integer
Optional
Maximum file size in bytes. Default: 10485760 (10 MiB)
Advanced Static Configuration
Section titled “Advanced Static Configuration”Static routes include optional configuration for performance and caching.
compression
Section titled “compression”Type: object
Optional
Advanced configuration for static file handling.
small_file_threshold: (integer) Threshold for small file optimization in bytes. Default:262144(256 KiB)min_gzip_size: (integer) Minimum size to enable gzip compression. Default:1024(1 KiB)min_brotli_size: (integer) Minimum size to enable brotli compression. Default:4096(4 KiB)enable_gzip: (boolean) Enable gzip compression. Default:trueenable_brotli: (boolean) Enable brotli compression. Default:true
cache_policy
Section titled “cache_policy”Type: object
Optional
Configuration for the Cache-Control header.
max_age: (integer)max-agevalue in seconds. Default:3600(1 hour)public: (boolean) Whether the cache ispublic. Default:trueimmutable: (boolean) Whether to add theimmutabledirective. Default:false
Operational Notes
Section titled “Operational Notes”Routing Priority
Both services and static routes use longest-prefix matching, meaning more specific routes take precedence over broader ones.