ISAPI_Rewrite

RewriteProxy directive

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

 

RewriteProxy directive 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.

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

  • 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_TYPEAUTH_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:[email protected]/path/ syntax as a URL within substitution string.
  • 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. 
  • K (keep-alive)

    Force keep-alive connection between the client and IIS server (not between IIS and back-end). If not specified, connection will be closed upon each request.

Proxy settings

ISAPI_Rewrite provides an opportunity to adjust some general proxy settings:

  • ProxyConnectTimeout — if a connection request takes longer than this time-out value, the request is canceled.
  • ProxySendTimeout — if sending a request takes longer than this time-out value, the send is canceled.
  • ProxyReceiveTimeout — if a response takes longer than this time-out value, the request is canceled.
  • ProxySuppressErrors — when On, proxy module will give out 500 Internal Server Error for any failures that may occur, while with Off, detailed error explanation is provided (helpful for maintenance).

Default values (in seconds) are shown in the example below:

<Helicon>
ProxyConnectTimeout 60
ProxySendTimeout 30
ProxyReceiveTimeout 30
ProxySuppressErrors On
</Helicon>

Note! <Helicon> section may be located either in the httpd.conf or in a specific <VirtualHost>.