Serve Akamai SureRoute Test Object from Proxy

We have Akamai fronting Apigee for some external clients and we need to configure the Akamai SureRoute Test Object to be returned from a Proxy.

The test object is just a static html file that the origin server should return to Akamai to aid in the network path races that they run to optimize routing.

See https://developer.akamai.com/legacy/learn/Optimization/SureRoute.html for further detail.

Is it possible to us an AssignMessage policy to serve the text/html response directly as opposed to creating a NodeJS app for the proxy? Are there any other options?

*Update: I was able to get this working by loading the html from a KVM and supplying that variable in an Assign Message policy payload. The payload is about 11KB so it seems like there shouldn't be much overhead in loading that.

I would have preferred if it could be supplied directly in the policy but when I tried to supply the content directly without loading it from a KVM it complains that it's invalid XML.

1 1 1,110
1 REPLY 1

Is it possible to us an AssignMessage policy to serve the text/html response directly as opposed to creating a NodeJS app for the proxy?

Yes, absolutely.

<AssignMessage name='AM-SureRouteResponse'>
  <IgnoreUnresolvedVariables>false</IgnoreUnresolvedVariables>
  <Set>
    <Payload contentType='text/html'><![CDATA[
      <!DOCTYPE html>
      <html>
        <head>
          <title>hello world</title>
        </head>
        <body>
          <h1>Hi there</h1>
        </body>
      </html>
]]>
    </Payload>
    <StatusCode>200</StatusCode>
    <ReasonPhrase>OK</ReasonPhrase>
  </Set>
</AssignMessage>

when I tried to supply the content directly without loading it from a KVM it complains that it's invalid XML.

Yes, you need to use the CDATA section as I've shown above to avoid that problem.