/
test-config.toml
85 lines (74 loc) · 3.13 KB
/
test-config.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# Test configuration file
#
# This is more in depth than the example.
#
# NOTE: Until we have made a release, configuration format should
# be considered entirely unstable, and likely to make breaking changes
# commit-to-commit!
[system]
# Threads per service
threads-per-service = 8
# Specify a Basic Proxy service, which features minimal configuration.
#
# Note that indentation isn't significant in TOML, it is only done
# here to note the structure of the data.
#
# TODO: This data is very structured, and TOML might not be a good fit.
[[basic-proxy]]
name = "Example1"
# Each `basic-proxy` can have one or more Listeners, or downstream
# connections. If you provide zero, the basic proxy will terminate
# immediately.
[[basic-proxy.listeners]]
# TODO: "listeners" only has one field, we might want to use
# serde flatten
[basic-proxy.listeners.source]
# Listeners can have kind of "Tcp" (w/ or w/o TLS) or "Uds"
# for "Unix Domain Sockets", which cannot have TLS.
kind = "Tcp"
[basic-proxy.listeners.source.value]
# TCP must specify the address, which includes the port to bind to
addr = "0.0.0.0:8080"
# `basic-proxy`s can have multiple listeners
[[basic-proxy.listeners]]
[basic-proxy.listeners.source]
kind = "Tcp"
[basic-proxy.listeners.source.value]
addr = "0.0.0.0:4443"
# To enable TLS, specify the path to the certificate and key
[basic-proxy.listeners.source.value.tls]
cert_path = "./assets/test.crt"
key_path = "./assets/test.key"
# Each `basic proxy` must have exactly one "connector", or the upstream
# server they will proxy to.
#
# To use TLS for upstream connections, specify the SNI of the connection
[basic-proxy.connector]
proxy_addr = "91.107.223.4:443"
tls_sni = "onevariable.com"
# "Path Control" affects requests and responses as they are proxied
[basic-proxy.path-control]
# upstream request filters specifically allow for the cancellation or modification
# of requests, as they are being made.
#
# Filters are applied in the order they are specified. Multiple instances of
# each filter may be provided.
upstream-request-filters = [
# Remove any headers with keys matching `pattern`
{ kind = "remove-header-key-regex", pattern = ".*(secret|SECRET).*" },
# Add or replace (e.g. "Upsert") a fixed header with the given key and value
{ kind = "upsert-header", key = "x-proxy-friend", value = "river" },
]
upstream-response-filters = [
# Remove any headers with keys matching `pattern`
{ kind = "remove-header-key-regex", pattern = ".*ETag.*" },
# Add or replace (e.g. "Upsert") a fixed header with the given key and value
{ kind = "upsert-header", key = "x-with-love-from", value = "river" },
]
# We specify a second basic proxy as well. Here we use the other table syntax
[[basic-proxy]]
name = "Example2"
listeners = [
{ source = { kind = "Tcp", value = { addr = "0.0.0.0:8000" } } }
]
connector = { proxy_addr = "91.107.223.4:80" }