To configure the odd-box proxy server, create a configuration file following the format provided in the example configuration file. The configuration file uses the TOML format and is designed to define both remote targets (sites that odd-box proxies traffic to) and hosted processes (sites or services managed directly by odd-box).
odd-box
Running odd-box without any arguments it will first try to read from odd-box.toml, then Config.toml. You can supply a custom config path using: ./odd-box “/tmp/my-file.toml”
It is also possible to update the active configuration at runtime thru an administration API which fully documents the possible settings.
Tip: if you are editing the confguration file using vs-code you should try the “even better toml” extension, which will provide you not only with syntax highlighting but also intellisense based on the configuration files ‘#:schema …’ tag.
There are more options than the ones shown here; these are the most commonly used ones. See the example configuration or schema.json file for a list of all possible options.
Global Settings: Set the global properties like http_port, tls_port, ip, log_level, port_range_start, and env_vars. These settings control the overall behavior of odd-box.
http_port
tls_port
ip
log_level
port_range_start
env_vars
#:schema https://raw.githubusercontent.com/OlofBlomqvist/odd-box/main/odd-box-schema-v2.json version = "V2" http_port = 8080 tls_port = 4343 ip = "127.0.0.1" log_level = "Trace" port_range_start = 4242 env_vars = [] lets_encrypt_account_email = "[email protected]"
version
lets_encrypt_account_email
Adding Remote Targets: Define remote targets to forward traffic to external servers. Each remote_target requires a host_name (the incoming domain) and a list of backends (the target servers). To add a new remote site:
[[remote_target]] host_name = "example.com" backends = [ # hints are optional and used for specifying if server requires for example H2C. { https = true, address="example.com", port=443, hints = [] } ]
host_name
backends
Adding Hosted Processes: Define hosted processes that odd-box will manage. These are services that odd-box can start, stop, and restart. Each hosted_process requires a host_name, dir, bin, and args:
dir
bin
args
[[hosted_process]] host_name = "myapp.local" dir = "/home/kalle/" # variables like $root_dir or $config_dir are allowed here bin = "/usr/bin/python3" # variables like $root_dir or $config_dir are allowed here args = ["-m", "http.server", "$port"] # variables like $port, $root_dir & $config_dir are allowed here exclude_from_start_all = false # if you do not wish start this site when pressing the 's' key in tui mode. auto_start = true hints = ["H1","H2","H2C","H2CPK","H3"] capture_subdomains = false https = false env_vars = [ { key = "some-environment-variable", value = "example-value" }, ]
auto_start
hints
https
enable_lets_encrypt
exclude_from_Start_all
capture_subdomains
Adding dir servers: for serving static websites or files. Supports directory indexing and markdown rendering.
[[dir_server]] host_name = "dir.localtest.me" dir = "$cfg_dir" enable_directory_browsing = true render_markdown = true