crumb
April 14, 2023, 3:40pm
1
I have a server defined that requires a query parameter to be passed into every request. How do I add this query parameter to my services.servers ?
services:
amb:
loadBalancer:
servers:
- url: https://my-url.com?myquery=parameter
crumb
April 16, 2023, 11:59pm
3
The problem with AddPrefix and Replace path is that they don't support query parameters. These are just for paths in the URI.
In the AddPrefix docs, it says " It should include a leading slash (/
)."
But thats not a query paramter. A query parameter is a question mark: "?query=parameter"
Can you use ReplacePathRegex
middleware to add the parameter to the original request?
crumb
April 17, 2023, 2:47pm
5
I'm trying that now and doesn't seem to be working:
http:
middlewares:
addon:
replacePathRegex:
regex: ^/.*
replacement: /$1\?billingtoken\=my-token-here
routers:
amb:
middlewares:
- addon
rule: Path(`/`)
service: amb
services:
amb:
loadBalancer:
healthCheck:
path: /health/v1/node
interval: 10s
servers:
- url: https://nd-x.t.x.x.us-east-1.amazonaws.com
The addon middleware doesn't seem to be working because the health check still fails as if its not getting the query parameter passed in
I would not expect the health check to run through middlewares.
Set up a traefik/whoami service to echo http headers and see what is been sent.