You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,13 @@ This changelog follows the patterns described here: https://keepachangelog.com/e
4
4
5
5
## Unreleased
6
6
7
+
## 0.5.0
8
+
### added
9
+
- Added support for proxying requests to arbitrary HTTP backends.
10
+
- This includes a basic CLI based config.
11
+
- This also includes a more robust `Trunk.toml` config which allows for specifying multiple proxies.
12
+
- Added a `trunk config show` subcommand. This command will pretty-print Trunk's final runtime config based on any config file & env vars. This can be useful for debugging & testing.
13
+
7
14
## 0.4.0
8
15
### added
9
16
- In addition to CLI arguments and options, Trunk now supports layered configuration via `Trunk.toml` & environment variables.
Copy file name to clipboardExpand all lines: CONTRIBUTING.md
+6Lines changed: 6 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,12 @@ contributing
2
2
============
3
3
We are all living beings, and what is most important is that we respect each other and work together. If you can not uphold this simple standard, then your contributions are not welcome.
4
4
5
+
## hacking
6
+
Just a few simple items to keep in mind as you hack.
7
+
8
+
- Pull request early and often. This helps to let others know what you are working on. **Please use Github's Draft PR mechansim** if your PR is not yet ready for review.
9
+
- Remember to update the `CHANGELOG.md` once you believe your work is nearing completion.
10
+
5
11
## linting
6
12
We are using clippy & rustfmt. Clippy is SO GREAT! Rustfmt ... has a lot more growing to do; however, we are using it for uniformity.
Copy file name to clipboardExpand all lines: README.md
+23Lines changed: 23 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -111,6 +111,29 @@ Trunk environment variables mirror the `Trunk.toml` config schema. All Trunk env
111
111
### cli arguments & options
112
112
The final configuration layer is the CLI itself. Any arguments / options provided on the CLI will take final precedence over any other config layer.
113
113
114
+
## proxy
115
+
Trunk ships with a built-in proxy which can be enabled when running `trunk serve`. There are two ways to configure the proxy, each discussed below. All Trunk proxies will transparently pass along the request body, headers, and query parameters to the proxy backend.
116
+
117
+
### proxy cli flags
118
+
The `trunk serve` command accepts two proxy related flags.
119
+
120
+
`--proxy-backend` specifies the URL of the backend server to which requests should be proxied. The URI segment of the given URL will be used as the path on the Trunk server to handle proxy requests. E.G., `trunk serve --proxy-backend=http://localhost:9000/api/` will proxy any requests received on the path `/api/` to the server listening at `http://localhost:9000/api/`. Further path segments or query parameters will be seamlessly passed along.
121
+
122
+
`--proxy-rewrite` specifies an alternative URI on which the Trunk server is to listen for proxy requests. Any requests received on the given URI will be rewritten to match the URI of the proxy backend, effectively stripping the rewrite prefix. E.G., `trunk serve --proxy-backend=http://localhost:9000/ --proxy-rewrite=/api/` will proxy any requests received on `/api/` over to `http://localhost:9000/` with the `/api/` prefix stripped from the request, while everything following the `/api/` prefix will be left unchanged.
123
+
124
+
### config file
125
+
The `Trunk.toml` config file accepts multiple `[[proxy]]` sections, which allows for multiple proxies to be configured. Each section requires at least the `backend` field, and optionally accepts the `rewrite` field, both corresponding to the `--proxy-*` CLI flags discussed above.
126
+
127
+
As it is with other Trunk config, a proxy declared via CLI will take final precedence and will cause any config file proxies to be ignored, even if there are multiple proxies declared in the config file.
128
+
129
+
The following is a snippet from the `Trunk.toml` file in this repo:
130
+
131
+
```toml
132
+
[[proxy]]
133
+
rewrite = "/api/v1/"
134
+
backend = "http://localhost:9000/"
135
+
```
136
+
114
137
## contributing
115
138
Anyone and everyone is welcome to contribute! Please review the [CONTRIBUTING.md](./CONTRIBUTING.md) document for more details. The best way to get started is to find an open issue, and then start hacking on implementing it. Letting other folks know that you are working on it, and sharing progress is a great approach. Open pull requests early and often, and please use Github's draft pull request feature.
0 commit comments