RewriteProxy directive

Description: Proxy request to a distant server
Syntax: RewriteProxy Pattern Substitution [flags]
Context: server config, virtual host, directory, .htaccess

 

Causes the resulting URL to be internally treated as a target on another server and immediately (i.e. rules processing stops here) passed to the remote server. Response of the remote server will then be passed back to the client. Proxy requires you to specify fully qualified URL, starting from protocol, host name, etc. ISAPI_Rewrite uses ISAPI extension to handle proxy requests. You can read more about this in configuring proxy chapter.

Syntax and operation is the same as for RewriteRule directive, but RewriteProxy directive supports some additional flags:

  • H (preserve Host)

    Proxy module will use Host header sent in original request when connecting to remote server. Without this flag proxy will compose Host header from a host name and a port of a remote server. 
  • A (Add authentication headers)

    Allows passing of an authentication information from proxy to an internal server when client authentication against a proxy server is used. Proxy module will append headers

    X-ISRW-Proxy-AUTH-TYPE,
    X-ISRW-Proxy-AUTH-USER,
    X-ISRW-Proxy-LOGON-USER,
    X-ISRW-Proxy-REMOTE-USER
    corresponding to server variables
    AUTH_TYPE,
    AUTH_USER,
    LOGON_USER,
    REMOTE_USER
    to a request sent to a proxied server.

  • CR (use Credentials)

    Proxy module will try to login on a remote server with the credentials specified in the URL or basic authentication headers. With this flag you can use http://user:password@host.com/path/ syntax as a URL within substitution string.