Skip to content

Commit f3a7676

Browse files
Merge pull request #7 from NHSDigital/APM-2884-fix-status-endpoint
APM-2884 deploy proxy
2 parents 6c0e1b7 + 7d5968d commit f3a7676

3 files changed

Lines changed: 7 additions & 22 deletions

File tree

proxies/live/apiproxy/policies/AssignMessage.HandleSplunkHec.xml

Lines changed: 0 additions & 16 deletions
This file was deleted.

proxies/live/apiproxy/proxies/default.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
</Request>
3232
<Response>
3333
<Step>
34-
<Name>AssignMessage.HandleSplunkHec</Name>
34+
<Name>javascript.SetStatusResponse</Name>
3535
</Step>
3636
</Response>
3737
<Condition>((proxy.pathsuffix MatchesPath "/status") and (request.verb = "GET")) or ((proxy.pathsuffix MatchesPath "/_status") and ((request.verb = "GET") or (request.verb = "HEAD")))
@@ -62,7 +62,7 @@
6262
<FaultRules>
6363
<FaultRule name="SplunkError">
6464
<Step>
65-
<Name>AssignMessage.HandleSplunkHec</Name>
65+
<Name>javascript.SetStatusResponse</Name>
6666
</Step>
6767
<Condition>(((proxy.pathsuffix MatchesPath "/status") and (request.verb = "GET")) or ((proxy.pathsuffix MatchesPath "/_status") and ((request.verb = "GET") or (request.verb = "HEAD")))) and (splunkCalloutResponse isNot null)
6868
</Condition>

proxies/live/apiproxy/resources/jsc/HealthCheck.SetResponse.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
const apiproxy_revision = context.getVariable('apiproxy.revision');
22

3-
const healthcheck_status_code = context.getVariable('healthcheckResponse.status.code');
4-
const healthcheck_request_url = context.getVariable('healthcheckRequest.url');
5-
const healthcheck_failed = context.getVariable("servicecallout.ServiceCallout.CallHealthcheckEndpoint.failed");
3+
const healthcheck_status_code = context.getVariable('splunkCalloutResponse.status.code');
4+
const healthcheck_request_url = context.getVariable('splunkCalloutRequest.url');
5+
const healthcheck_failed = context.getVariable("servicecallout.ServiceCallout.LogToSplunk.failed");
66

77
function json_tryparse(raw) {
88
try {
@@ -13,7 +13,7 @@ function json_tryparse(raw) {
1313
}
1414
}
1515

16-
const healthcheck_content = json_tryparse(context.getVariable('healthcheckResponse.content'));
16+
const healthcheck_content = json_tryparse(context.getVariable('splunkCalloutResponse.content'));
1717
const healthcheck_status = (healthcheck_status_code/100 === 2) ? "pass" : "fail";
1818
const timeout = (healthcheck_status_code === null && healthcheck_failed) ? "true" : "false";
1919

@@ -39,3 +39,4 @@ const resp = {
3939
context.setVariable("status.response", JSON.stringify(resp));
4040
context.setVariable("response.content", JSON.stringify(resp));
4141
context.setVariable("response.header.Content-Type", "application/json");
42+

0 commit comments

Comments
 (0)