Blog |Follow Nick on Twitter| About
 

---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- [![Bluecoat Reverse Proxy Health Check Diagram](https://www.linickx.com/files/2009/05/bc-rev-porxy-health-diagram-150x150.png "Bluecoat Reverse Proxy Health Check Diagram")](https://www.linickx.com/files/2009/05/bc-rev-porxy-health-diagram.png) Bluecoat Reverse Proxy Health Check Diagram ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Consider the attached diagram, a customer wants a fairly simple reverse HTTP proxy solution; behind the bluecoat is two servers one hosting pages for server1.domain.com and the other for server2.domain.com (both of these DNS names resolve to the IP address of the bluecoat).

The requirement comes with a twist, in the event that either server goes down they want requests sent to another "we're sorry the site is down" server, below is some pseudo-code explaining what we want the bluecoat to do when it receives a HTTP request.

If (URL = http://server1.domain.com ) then If ( webserver1 = healthy) then Forward webserver1 Else Forward backupserver Fi Fi If (URL = http://server2.domain.com) then If ( webserver2 = healthy) then Forward webserver2 Else Forward backupserver Fi Fi
Now it took me some time to find out how to do this, some can be applied in the GUI, the rest has to be applied in Content Policy Language (CPL). If you want to do something similar start by defining some forwarding hosts in the GUI click: Configure -> Forwarding Hosts -> New . In this example only use IP addresses, it makes things simple later, so server1.domain.com =

  • alias = 192.168.1.1
  • host = 192.168.1.1
  • type = server
  • ports = HTTP 80

then server2.doamin.com is...

  • alias = 192.168.1.2
  • host = 192.168.1.2
  • type = server
  • ports = HTTP 80

and the backup webserver is...

  • alias = 192.168.1.3
  • host = 192.168.1.3
  • type = server
  • ports = HTTP 80

If you now click: Heath Checks -> General you'll see that some health checks like fwd.192.168.1.3 have been created for you.

Next In the VPM (Policy -> Visual Policy Manager -> Launch) create a web access layer permitting "any" to your webserver hosts server1.domain.com & server2.domain.com

Finally you need to upload come CPL ( Policy -> Policy Files -> Under: Install Local File from -> Select: Text Editor -> Install)

<Forward>
    ; Forward to server1.domain.com
    server_url.host.exact="server1.domain.com" is_healthy.fwd.192.168.1.1=yes forward(192.168.1.1)
    server_url.host.exact="server1.domain.com" is_healthy.fwd.192.168.1.1=no forward(192.168.1.3)
    ; Forward to server2.domain.com
    server_url.host.exact="server2.domain.com" is_healthy.fwd.192.168.1.2=yes forward(192.168.1.2)
    server_url.host.exact="server2.domain.com" is_healthy.fwd.192.168.1.2=no forward(192.168.1.3)

Change as necessary, but now if server1.domain.com goes down the page on 192.168.1.3 is displayed (and the same happens for server2) neat!

(Correct as of SGOS 5.4.1.3 as usual YMMV!)

rgds,

Nick

 
Nick Bettison ©