Oh misread, got the ports mixed up. But you only gave the last log entry which didn’t show the whole picture, I wanted to see all of the logs for a single request (including the debug log from the initial proxy on 8080 as well).
I have to assume that your API call has a POST body? In that case the problem is the proxy attempt to 8080 consumes the POST body, so it can’t be used in handle_response anymore (it’s now empty).
Caddy doesn’t buffer the request body. It’s a stream, so once it gets consumed, it’s gone.
We do have a request_buffers option but it doesn’t rewind to allow replay in this situation. That could be something we add in the future though.
So looking back at your original question, what’s wrong with the other config with path matching instead? That’s more efficient anyway because you avoid having to do two roundtrips in the case that it fails with the first upstream.