Given a backend providing a route /pfx2/get_something, here mocked with the following config:
server "be" {
hosts = ["*:8081"]
api {
base_path = "/pfx2"
endpoint "/get_something" {
response {
json_body = ["foo", "bar"]
}
}
}
}
Now I want to proxy a request to this backend route while providing the endpoint with a different path prefix: /pfx1/get_something:
server "gw" {
hosts = ["*:8080"]
api {
base_path = "/pfx1"
endpoint "/get_something" {
proxy {
backend = "be"
url = "/get_something"
}
}
}
}
definitions {
backend "be" {
origin = "http://localhost:8081"
path = "/pfx2/**"
}
}
Currently, there seems to be no way to do this without either
proxy {
backend = "be"
url = "/get_something"
}
or
proxy {
backend "be" {
path = "/get_something"
}
}
I'd consider both solutions ugly.
Any ideas how to do it more elegantly?
Given a backend providing a route
/pfx2/get_something, here mocked with the following config:Now I want to proxy a request to this backend route while providing the endpoint with a different path prefix:
/pfx1/get_something:Currently, there seems to be no way to do this without either
or
I'd consider both solutions ugly.
Any ideas how to do it more elegantly?