One would naively have expected the retry middleware to satisfy this requirement. Unfortunately (and by design) this does not work as it appears to receive a 503 status code from the backend service and, as is clearly stated in the documentation, treats any response whatsoever from downstream services as a non-retryable event.
To navigate around this, I used the error middleware instead. With this, I also provided a deployment (with associated service) in my cluster/namespace that was capable of serving a static html page that automatically refreshed e.g. some html that contained:
<meta http-equiv="refresh" content="5">
My middleware configuration looked like:
apiVersion: traefik.io/v1alpha1
kind: Middleware
metadata:
name: retry-on-503
spec:
errors:
status:
- "503"
query: /retry.html
service:
name: staticsite
port: 80
Whilst not ideal as the retry is exposed to the client, this works for my specific needs.