Topic
  • 2 replies
  • Latest Post - ‏2013-05-09T14:28:37Z by HisNibs
Chris.Z
Chris.Z
70 Posts

Pinned topic How to respond to a health check

‏2013-05-03T13:13:17Z |

So I am wanting to send a health check request to each interface.  In each of our domains we have an MPG that listens for traffic on a URL, then passes that request to the appropriate WSP that is subscribed to a WSDL(normally through WSRR).  I would like to create a rule inside the WSP that says "if it's from this address, respond successful with out checking anything on the backend".  I've been googling and messing with this for a couple days.  Anyone have any tips?

  • Chris.Z
    Chris.Z
    70 Posts

    Re: How to respond to a health check

    ‏2013-05-06T14:06:03Z  

     

    For anyone who sees this in the future.  We are using this code, and it seems to work for what we want to do.  Create this as .xsl, and make a transformation in your request rule.
    
    <xsl:template match="/">
      <xsl:variable name="X-clientIP" select="dp:request-header('X-Client-IP')"/> 
      <xsl:variable name="clientIP" select="substring-before($X-clientIP,',')"/>
       <xsl:if test="$clientIP='*EnterIP Here*' or $clientIP='
    *EnterIP Here*
    '">
         <dp:reject override="true">Successful health check</dp:reject> 
       </xsl:if>  
     <xsl:copy-of select="."/> 
     </xsl:template>
    
  • HisNibs
    HisNibs
    87 Posts

    Re: How to respond to a health check

    ‏2013-05-09T14:28:37Z  
    • Chris.Z
    • ‏2013-05-06T14:06:03Z

     

    <pre dir="ltr" style="color: rgb(0, 0, 0); word-wrap: break-word; white-space: pre-wrap;">For anyone who sees this in the future. We are using this code, and it seems to work for what we want to do. Create this as .xsl, and make a transformation in your request rule. <xsl:template match="/"> <xsl:variable name="X-clientIP" select="dp:request-header('X-Client-IP')"/> <xsl:variable name="clientIP" select="substring-before($X-clientIP,',')"/> <xsl:if test="$clientIP='*EnterIP Here*' or $clientIP=' *EnterIP Here* '"> <dp:reject override="true">Successful health check</dp:reject> </xsl:if> <xsl:copy-of select="."/> </xsl:template> </pre>

    Simpler way would be to add a set variable action on a ruleset and set it to service/skip-backside = 1, making sure the match rule is set to the address you want the HC to respond against

    Then run a simple XFORM to send back a formatted message of your choice

    Updated on 2013-05-09T14:29:28Z at 2013-05-09T14:29:28Z by HisNibs