Local domain remap with proxy : Infinite 301 redirect, bad URL typo

Found the problem / the solution:

while using the proxy, the servers variable REQUEST_URI is not the same

using FoxyProxy, server var ‘REQUEST_URI’ return the full url:

$_SERVER[‘REQUEST_URI’]
-> “hxxp://mydomain.com/theurl”

using windows host file, server var ‘REQUEST_URI’ return just the end of the url:
$_SERVER[‘REQUEST_URI’]
-> “/theurl”

so I added this to the wordpress index.php and everything works #1 😀 :

$_SERVER['REQUEST_URI'] = requesturl_format($_SERVER['HTTP_HOST'], $_SERVER['REQUEST_URI']);

function requesturl_format($m_host, $m_request){
    $m_regex = sprintf('#(https?://)(%s)(/.*)#', $m_host);

    if(preg_match( $m_regex, $m_request, $matches)){
        if(count($matches) == 4){

            $m_host = ($matches[1]);
            $m_domain = ($matches[2]);
            $m_url_req = ($matches[3]);
            return $m_url_req;
        }
    }
    return $m_request;
}