Rewriting HTTP responses

Hello all! Can anybody help me?

I have this sheme:

I need rewrite domain1.com/app to domain.com/app when domain1.com/app i’m get from backend as 302 - redirect.

In nginx i’m use: proxy_redirect option for this, how i can make this in haproxy?