Skip to content

Commit

Permalink
- refine the config file to use unified test websites
Browse files Browse the repository at this point in the history
- add some examples to cover different scenarios (HTTP vs HTTPS)
  • Loading branch information
jpi-bd committed Nov 1, 2024
1 parent c32ffad commit 546b58e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
34 changes: 26 additions & 8 deletions examples/config.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
[runtime]
# runtime_type = "legacy"
runtime_type = "io_uring"
worker_threads = 2
entries = 1024

[servers.demo_basic]
name = "gateway.monolake.rs"
listener = { type = "socket", value = "0.0.0.0:8080" }
upstream_http_version = "http2"
upstream_http_version = "http11"
http_opt_handlers = { content_handler = true }

# front-end HTTP, back-end HTTP
[[servers.demo_basic.routes]]
path = '/'
upstreams = [{ endpoint = { type = "uri", value = "https://www.bytedance.com/" } }]
upstreams = [{ endpoint = { type = "uri", value = "http://ifconfig.me/" } }]

# front-end HTTP, back-end HTTPS
[[servers.demo_basic.routes]]
path = '/github'
upstreams = [{ endpoint = { type = "uri", value = "https://github.com/" } }]
path = '/example'
upstreams = [{ endpoint = { type = "uri", value = "https://example.com/" } }]


[servers.demo_tls]
Expand Down Expand Up @@ -58,10 +60,18 @@ tls = { chain = "examples/certs/server.crt", key = "examples/certs/server.key",
name = "gateway.monolake.rs"
listener = { type = "socket", value = "0.0.0.0:8082" }

# front-end HTTPS, back-end HTTP
[[servers.demo_rustls.routes]]
path = '/'
upstreams = [
{ endpoint = { type = "uri", value = "https://www.wikipedia.org" } },
{ endpoint = { type = "uri", value = "http://ifconfig.me" } },
]

# front-end HTTPS, back-end HTTPS
[[servers.demo_rustls.routes]]
path = '/example'
upstreams = [
{ endpoint = { type = "uri", value = "https://example.com" } },
]


Expand All @@ -70,11 +80,19 @@ tls = { chain = "examples/certs/server.crt", key = "examples/certs/server.key",
name = "gateway.monolake.rs"
listener = { type = "socket", value = "0.0.0.0:8083" }

# front-end HTTPS, back-end HTTP
[[servers.demo_native_tls.routes]]
path = '/'
upstreams = [
{ endpoint = { type = "uri", value = "https://www.wikipedia.org" } },
{ endpoint = { type = "uri", value = "http://ifconfig.me" } },
]

# front-end HTTPS, back-end HTTPS
[[servers.demo_native_tls.routes]]
path = '/example'
upstreams = [
{ endpoint = { type = "uri", value = "https://example.com" } },
]
path = '/'


[servers.demo_timeout]
Expand Down
2 changes: 1 addition & 1 deletion examples/gen_cert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ openssl x509 -req -sha512 -days 3650 \
-out server.crt

# Convert files
rm rootCA.srl server.csr v3.ext
rm -f rootCA.srl server.csr v3.ext
openssl pkcs8 -topk8 -inform PEM -outform PEM -nocrypt -in server.key -out server.pkcs8

0 comments on commit 546b58e

Please sign in to comment.