InnoTecSol >ICS >ICS Version: 0.4.8888 Documentation >http(x) >http rewrite extension library
ICS Version: 0.4.8888
http rewrite extension library

The http rewrite plug-in provides the means to rewrite/manipulate requests.

The following outlines the steps required to activate and configure the rewrite extension library to perform request manipulation.

In order to activate the http rewrite plug-in the httprewrite extension library must be loaded according to extension library configuration.

The rewrite module must be the last library to be loaded, thus that request manipulations of other modules are processed before the rewrite module is executed

Windows:


<EXTLIBS>
	<LIB>C:\Programs\ics\bin\httprewrite.dll</LIB>
</EXTLIBS>
	

Unix:


<EXTLIBS>
	<LIB>/usr/lib64/ics/libhttprewrite.so</LIB>
</EXTLIBS>
	

<EXTLIBS>
	<LIB>/usr/lib32/ics/libhttprewrite.so</LIB>
</EXTLIBS>
	

The httprewrite configuration is introduced by the httpx:HTTPREWRITE tag an can be child of the HOST tag or NODE tag.


<HOST>
   <httpx:HTTPREWRITE>
		<RULESET>
			<COND>
				<MATCH>
				</MATCH>
			</COND>
			<REWRITE />
		</RULESET>
   </httpx:HTTPREWRITE>
</HOST>
	

The httprewrite condition configuration is introduced by the COND tag and can be child of the RULESET tag.

Multiple COND tags can be specified that are combined by an OR operation.


<HOST>
   <httpx:HTTPREWRITE>
		<RULESET>
			<COND>
				<MATCH VAR="REQUEST_FILENAME" OP="NOT" FUNC="DEXISTS" >
				</MATCH>
			</COND>
			<COND>
				<MATCH VAR="REQUEST_FILENAME" OP="NOT" FUNC="FEXISTS">
				</MATCH>
			</COND>
			<REWRITE />
		</RULESET>
   </httpx:HTTPREWRITE>
</HOST>
	

The COND tag can have on or several MATCH tags which define the condition checks.

Mutliple MATCH tags can be specified and comprise a AND operation

MATCH

The MATCH tag comprises three attributes

  • VAR
  • OP
  • FUNC

The VAR attribute can specify one of the following variables:

  • REQUEST_FILENAME - the evaluated filename requested
  • REQUEST_URL - the request url
  • HTTP_* - a http header variable prefixed with HTTP_

The OP attribute can be one of the following operators

  • NOT - not true
  • EQ - true

The FUNC attribute can be one of the following Functions

  • FEXISTS - returns true if the variable exists as file
  • DEXISTS - returns true if the variable exists as directory
  • EXISTS - returns true if the variable exits as file or directory