best approach to run http proxy between two vhosts

So I am migrating a system that uses a portal that derives its code base from the home application, but it needs to push the URL through the index.php for processing.

I've tried setting static context but that is looking for a physical location - what I need to do is pass the extra location data so that the main engine can process it.

However, I also need to passthrough a resource directory as a static context (there is a physical location.

I have two vhosts set up that point to the same docroot.

Main software is in

Portal vhost is but I need to push the /(.*) to

In other words,* needs to map to*

However,* needs to map to* - the resource folder needs to be, essentially, excluded from the extra mapping.

In Nginx it looks like this:

  # Resource proxy
  location ~* ^/resource/ {
    rewrite ^/resource/(.*) /resource/$1 break;

  # Everything else
  location / {
    rewrite ^/(.*) /portal/biportal/$1 break;
    proxy_set_header DevblocksProxySSL 1;
    proxy_set_header DevblocksProxyHost;
    proxy_set_header DevblocksProxyBase "";
The headers are used by the software - they aren't as important. I guess I don't know if I should use rewrites, try to set a static context, or set up an external app - what is the most streamlined way to do this?
I was able to get this to work but is there any method that preserves the host being called?

When I visit it does rewrite/map to - but it changes the URL as well - it doesn't stay as