the redirect_uri error tells me that the provided redirect_uri by the call is not matching with the trusted redirect_uris in zitadel which should be matching with auth.foo.com if you set up zitadel with this configuration, and not changed this configuration after you did the setup
I'm by no means an expert with nginx so it's kinda hard for me to pinpoint the problem without trying to reproduce it. I know that we have an example with traeffik (https://zitadel.com/docs/guides/deploy/loadbalancing-example) maybe that helps some, otherwise maybe somebody with a bit more experience with nginx like @FFO or @Elio has an idea, if not I can look into it on monday if that helps.