vADC Docs

Rate Limit only client Traffic from CDN/Proxy or Header Value

by dnahas on ‎11-16-2012 02:41 PM (1,002 Views)

For this example the client requests come from the CDN acting as a proxy. We don’t want to impose any limits on the CDN requests coming to the site, but we do want to stop abusive users.  


In this case all client requests that we want to limit from the CDN Proxy contain a HTTP Header; for this example we’ll say True-Client-IP.  We will use the "True-Client-IP" header value as the context value for the rate class, and we already have a rate class named "clients".


A context value on a rate clasee uses a new rate class which inherits all of the rate settings from the named rate class. All connections called with the same 'context' value use the same new rate class. This allows you to shape connections based on arbitary data, such as a user name or source IP address, shaping connections from different users or source IPs independently.


  #Check and run if the True-Client-IP header exists

  if( !http.headerExists( "True-Client-IP" ) ){

     #Use the predefined rate class named "clients"

     #Use the header vale to define a context to the rate class

   rate.use( "clients", http.getHeader ("True-Client-IP" ) );