Mimic nginx proxy_pass in fcgi

In my scenario, the rules are complex enough that I have to hand off to
fcgi from nginx. I use proxy_pass to hand off to fcgi where the actual
redirection happens based on some complex conditions.
But instead of using the Location Header in fcgi which is a rewrite, I
want to preserve the headers.
Looking to mimic how nginx does proxy_pass in fcgi. Thanks!