Redirect to the error backend using the current url path

Hi all,

I am following the https://docs.traefik.io/configuration/commons/#custom-error-pages instructions inside a docker swarm, which I've gotten working.

Now, I'd like to set the custom error page based on the original path requested. So, for example. I got an incoming request for

https://somewebsite.com/this/is/a/bad/url

I'd want the resulting redirect query to function like this:

traefik.frontend.errors.networks.query: "{path}"

This would mean, the request to the error backend would be something like...

error.backend/this/is/a/bad/url

Looking at traefik/middlewares/errorpages/error_pages.go at v1.7 · traefik/traefik · GitHub

I suspect what I'm looking for isn't possible in 1.7 - it looks like it will simply replace {status} and nothing else. So it will either take a hard coded string, or, auto-populated {status}

if len(h.backendQuery) > 0 {
query = "/" + strings.TrimPrefix(h.backendQuery, "/")
query = strings.Replace(query, "{status}", strconv.Itoa(recorder.GetCode()), -1)
}