Skip to content
Merged
Show file tree
Hide file tree
Changes from 38 commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
4b5ee05
update struct tags
jranson Jun 5, 2025
6882efd
support host header injection
jranson Jun 5, 2025
df1e3e0
add/use MatchExactPath constant
jranson Jun 7, 2025
cba4cc7
unDRY path key generation
jranson Jun 7, 2025
e97b2bb
add consts for prefix/exact match type names
jranson Jun 8, 2025
36e3e9f
relocate pprof routing to own pkg
jranson Jun 8, 2025
4844515
add pointers pkg
jranson Jun 8, 2025
29aca4c
add clone and pare
jranson Jun 10, 2025
62af361
Merge branch 'main' into jr/path-configs-fix
jranson Jul 4, 2025
c677173
use observability/pprof + add tests
jranson Jul 4, 2025
46f34a8
use idiomatic instantiation of builtin types
jranson Jul 4, 2025
1766f02
use methods.GetAndPost helper method
jranson Jul 4, 2025
5e943d9
add PathTypeName type
jranson Jul 4, 2025
99eb4f2
undry function name vs pkg name
jranson Jul 5, 2025
710d172
remove duplicate validation
jranson Jul 16, 2025
6dcf86c
refactor paths to use List instead of Lookup
jranson Sep 19, 2025
8d4238a
remove unused pkg
jranson Sep 19, 2025
fce01a5
changed named paths to sequence
jranson Sep 19, 2025
f568bc1
Merge branch 'main' into jr/path-configs-fix
jranson Sep 19, 2025
ce04f89
Merge branch 'main' into jr/path-configs-fix
jranson Dec 4, 2025
5f159a3
Merge branch 'main' into jr/path-configs-fix
jranson Dec 4, 2025
e5d33a2
cat trickster.yaml | yq
jranson Dec 4, 2025
04244c2
use o for Options var
jranson Dec 4, 2025
b0133c8
add pointer-based yaml unmarshalers
jranson Dec 4, 2025
b0082f3
fix broken test
jranson Dec 5, 2025
5d0ec84
fix cloning issue
jranson Dec 5, 2025
9793cf5
remove unused/commented code
jranson Dec 5, 2025
d0751fe
refactor validate vs initialize
jranson Dec 5, 2025
f8b182b
refactor validate vs initialize
jranson Dec 5, 2025
ed7f267
refactor validate vs initialize
jranson Dec 5, 2025
1eac971
streamline startup and config reloads with BootstrapConfig()
jranson Dec 5, 2025
ce2024f
streamline daemon/listener startup
jranson Dec 5, 2025
603c642
add handler assignment
jranson Dec 5, 2025
77de322
remove unused func
jranson Dec 5, 2025
5dd716a
add methods helper funcs
jranson Dec 5, 2025
2d01431
refactor overlay
jranson Dec 5, 2025
ad2729a
update router to use Overlay
jranson Dec 5, 2025
f642970
Merge branch 'main' into jr/path-configs-fix
jranson Dec 5, 2025
c74f800
go mod tidy
jranson Dec 5, 2025
cbae6c3
add mechanism consts
jranson Dec 6, 2025
979dd7d
use slices.ContainsFunc
jranson Dec 6, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/trickster/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const (
)

func main() {
appinfo.SetAppInfo(applicationName, applicationVersion,
appinfo.Set(applicationName, applicationVersion,
applicationBuildTime, applicationGitCommitID)
err := daemon.Start()
if err != nil {
Expand Down
3 changes: 1 addition & 2 deletions deploy/kube/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,7 @@ data:
# # [backends.BACKEND_NAME.paths] section customizes the behavior of Trickster for specific paths. See /docs/paths.md for more info.
# paths:
# example1:
# path: /api/v1/admin/
# - path: /api/v1/admin/
# methods: [ '*' ] # HTTP methods to be routed with this path config. * for all methods.
# match_type: prefix # match $path* (using exact will match just $path)
# handler: localresponse # dont actually proxy this request, respond immediately
Expand Down
20 changes: 7 additions & 13 deletions docs/authenticator.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,25 +60,21 @@ backends:
authenticator_name: example_auth_1 # protects backend01 with example_auth_1 authenticator
origin_url: https://example.com
paths:
root:
path: / # all requests are protected by example_auth_1
- path: / # all requests are protected by example_auth_1
match_type: prefix
handler: proxy

backend02:
provider: reverseproxy # no backend-wide authenticator
origin_url: https://example.com
paths:
root:
path: / # requests will be allowed without auth except the 2 Paths below
- path: / # requests will be allowed without auth except the 2 Paths below
match_type: prefix
handler: proxy
protected_a:
path: /private/
- path: /private/
authenticator_name: example_auth_2 # example_auth_2 protects this path only
handler: proxy
protected_b:
path: /admin/
- path: /admin/
authenticator_name: example_auth_3 # example_auth_3 protects this path only
handler: proxy

Expand All @@ -87,15 +83,13 @@ backends:
authenticator_name: example_auth_1 # protects backend03 with example_auth_1 authenticator
origin_url: https://example.com
paths:
path: / # requests will be challenged by example_auth_1 except the 2 Paths below
- path: / # requests will be challenged by example_auth_1 except the 2 Paths below
match_type: prefix
handler: proxy
unprotected:
path: /public/
- path: /public/
authenticator_name: none # requests to /public will be allowed without auth
handler: proxy
protected_a:
path: /app/admin/
- path: /app/admin/
authenticator_name: example_auth_2 # example_auth_2 protects this path, not auth_1
handler: proxy

Expand Down
6 changes: 2 additions & 4 deletions docs/collapsed-forwarding.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,11 @@ Example:
origins:
test:
paths:
thing1:
path: /test_path1/
- path: /test_path1/
match_type: prefix
handler: proxycache
progressive_collapsed_forwarding: true
thing2:
path: /test_path2/
- path: /test_path2/
match_type: prefix
handler: proxy
progressive_collapsed_forwarding: true
Expand Down
46 changes: 17 additions & 29 deletions docs/developer/environment/trickster-config/trickster.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
frontend:
listen_port: 8480

negative_caches:
default:
'400': 3s
'404': 3s
'500': 3s
'502': 3s

caches:
mem1:
cache_type: memory
Expand All @@ -19,26 +17,22 @@ caches:
cache_type: memory
provider: memory
index:
max_size_objects: 1024
max_size_objects: 1024
max_size_backoff_objects: 128
fs1:
cache_type: filesystem
provider: filesystem

request_rewriters:

remove-accept-encoding:
instructions:
- [ header, delete, Accept-Encoding ]

- [header, delete, Accept-Encoding]
range-to-instant:
instructions:
- [ path , set , /api/v1/query ]
- [ param , delete , start ]
- [ param , delete , end ]
- [ param , delete , step ]
- [ chain , exec , remove-accept-encoding ]

- [path, set, /api/v1/query]
- [param, delete, start]
- [param, delete, end]
- [param, delete, step]
- [chain, exec, remove-accept-encoding]
rules:
example:
input_source: header
Expand All @@ -53,7 +47,6 @@ rules:
- matches:
- 'trickster:'
next_route: sim1

tracing:
jc1:
provider: otlp
Expand All @@ -66,7 +59,6 @@ tracing:
endpoint: '127.0.0.1:6831'
omit_tags:
- http.url

backends:
alb1:
provider: alb
Expand Down Expand Up @@ -146,13 +138,13 @@ backends:
healthcheck:
interval: 300ms
timeout: 500ms
# uncomment and set certs to test TLS
# tls:
# full_chain_cert_path: >-
# /example/certs/127.0.0.1.pem
# private_key_path: >-
# /example/certs/127.0.0.1-key.pem
# insecure_skip_verify: true
# uncomment and set certs to test TLS
# tls:
# full_chain_cert_path: >-
# /example/certs/127.0.0.1.pem
# private_key_path: >-
# /example/certs/127.0.0.1-key.pem
# insecure_skip_verify: true
sim2:
provider: prometheus
origin_url: 'http://127.0.0.1:8482/prometheus'
Expand All @@ -177,22 +169,18 @@ backends:
origin_url: 'http://127.0.0.1:8482/byterange'
cache_name: fs1
paths:
root:
path: /
- path: /
match_type: prefix
handler: proxycache
rpc2:
provider: reverseproxycache
origin_url: 'http://127.0.0.1:8482/byterange'
cache_name: mem1
paths:
root:
path: /
- path: /
match_type: prefix
handler: proxycache

logging:
log_level: info

metrics:
listen_port: 8481
listen_port: 8481
38 changes: 13 additions & 25 deletions docs/paths.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ backends:
provider: rpc
origin_url: 'http://example.com'
paths:
root:
path: /
- path: /
req_rewriter_name: example

```
Expand Down Expand Up @@ -76,7 +75,7 @@ backends:
default:
# ...
paths:
root:
- path: /
# ...
request_params:
'token': '${REQUEST_PARAM_TOKEN}'
Expand Down Expand Up @@ -136,10 +135,8 @@ backends:
default:
provider: rpc
paths:
# root path '/'. Paths must be uniquely named but the
# name is otherwise unimportant
root:
path: / # each path must be unique for the backend
# root path '/'
- path: / # each path must be unique for the backend
methods: [ '*' ] # All HTTP methods applicable to this config
match_type: prefix # matches any path under '/'
handler: proxy # proxy only, no caching (this is the default)
Expand All @@ -155,8 +152,7 @@ backends:
# before replying to the client
response_headers:
Expires: '-1'
images:
path: /images/
- path: /images/
methods:
- GET
- HEAD
Expand All @@ -165,8 +161,7 @@ backends:
response_headers:
Cache-Control: max-age=2592000 # cache for 30 days
# but only cache this rotating image for 30 seconds
images_rotating:
path: /images/rotating.jpg
- path: /images/rotating.jpg
methods:
- GET
handler: proxycache
Expand All @@ -175,8 +170,7 @@ backends:
Cache-Control: max-age=30
'-Expires': ''
# redirect this sunsetted feature to a discontinued message
redirect:
path: /blog
- path: /blog
methods:
- '*'
handler: localresponse
Expand All @@ -185,8 +179,7 @@ backends:
response_headers:
Location: /discontinued
# cache this API endpoint, keying on the query parameter
api:
path: /api/
- path: /api/
methods:
- GET
- HEAD
Expand All @@ -195,8 +188,7 @@ backends:
cache_key_params:
- query
# same API endpoint, different HTTP methods to route against, which are denied
api-deny:
path: /api/
- path: /api/
methods:
- POST
- PUT
Expand All @@ -209,8 +201,7 @@ backends:
response_code: 401
response_body: this is a read-only api endpoint
# cache the query endpoint, permitting GET, HEAD, POST
api-query:
path: /api/query/
- path: /api/query/
methods:
- GET
- HEAD
Expand Down Expand Up @@ -242,24 +233,21 @@ backends:
paths:
# route /api/v1/label* (including /labels/*)
# through Proxy instead of ProxyCache as pre-defined
label:
path: /api/v1/label
- path: /api/v1/label
methods:
- GET
match_type: prefix
handler: proxy
# route fictional new /api/v1/coffee to ProxyCache
series_range:
path: /api/v1/coffee
- path: /api/v1/coffee
methods:
- GET
match_type: prefix
handler: proxycache
cache_key_params:
- beans
# block /api/v1/admin/ from being reachable via Trickster
admin:
path: /api/v1/admin/
- path: /api/v1/admin/
methods:
- GET
- POST
Expand Down
36 changes: 17 additions & 19 deletions examples/conf/example.full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,7 @@ backends:

# # the paths section customizes the behavior of Trickster for specific paths for this Backend. See /docs/paths.md for more info.
# paths:
# example1:
# path: /api/v1/admin/
# - path: /api/v1/admin/
# methods: [ '*' ] # HTTP methods to be routed with this path config. * for all methods.
# match_type: prefix # match $path* (using exact will match just $path)
# handler: localresponse # dont actually proxy this request, respond immediately
Expand All @@ -449,23 +448,22 @@ backends:
# response_headers:
# Cache-Control: no-cache # attach these headers to the response down to the client
# Content-Type: text/plain
# example2:
# path: /example/
# methods: [ GET, POST ]
# collapsed_forwarding: progressive # see /docs/collapsed_forwarding.md
# match_type: prefix # this path is routed using prefix matching
# handler: proxycache # this path is routed through the cache
# req_rewriter_name: example-rewriter # name of a rewriter to modify the request prior to handling
# cache_key_params: [ ex_param1, ex_param2 ] # the cache key will be hashed with these query parameters (GET)
# cache_key_form_fields: [ ex_param1, ex_param2 ] # or these form fields (POST)
# cache_key_headers: [ X-Example-Header ] # and these request headers, when present in the incoming request
# request_headers:
# Authorization: custom proxy client auth header
# -Cookie: '' # attach these request headers when proxying. the + in the header name
# +Accept-Encoding: gzip # means append the value if the header exists, rather than replace
# # while the - will remove the header
# request_params:
# +authToken: SomeTokenHere # manipulate request query parameters in the same way
# - path: /example/
# methods: [ GET, POST ]
# collapsed_forwarding: progressive # see /docs/collapsed_forwarding.md
# match_type: prefix # this path is routed using prefix matching
# handler: proxycache # this path is routed through the cache
# req_rewriter_name: example-rewriter # name of a rewriter to modify the request prior to handling
# cache_key_params: [ ex_param1, ex_param2 ] # the cache key will be hashed with these query parameters (GET)
# cache_key_form_fields: [ ex_param1, ex_param2 ] # or these form fields (POST)
# cache_key_headers: [ X-Example-Header ] # and these request headers, when present in the incoming request
# request_headers:
# Authorization: custom proxy client auth header
# -Cookie: '' # attach these request headers when proxying. the + in the header name
# +Accept-Encoding: gzip # means append the value if the header exists, rather than replace
# # while the - will remove the header
# request_params:
# +authToken: SomeTokenHere # manipulate request query parameters in the same way

# # the tls section configures the frontend and backend TLS operation for the backend
# tls:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@ backends:
tracing_name: ja1
cache_name: mem1
paths:
root:
path: /
- path: /
match_type: prefix
handler: proxycache
collapsed_forwarding: progressive
Expand Down
2 changes: 1 addition & 1 deletion pkg/appinfo/appinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var GitCommitID string
// By default uses the hostname reported by the kernel
var Server, _ = os.Hostname()

func SetAppInfo(name, version, buildTime, gitCommitID string) {
func Set(name, version, buildTime, gitCommitID string) {
Name = name
Version = version
BuildTime = buildTime
Expand Down
Loading
Loading