Skip to content

Commit

Permalink
Add CORS headers to catchAll Error response
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslinnell committed Aug 22, 2023
1 parent d2c6cdb commit 566fa0b
Showing 1 changed file with 36 additions and 36 deletions.
72 changes: 36 additions & 36 deletions proxies/sandbox/apiproxy/proxies/default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,48 +2,48 @@
<ProxyEndpoint name="default">
<Flows>
<Flow name="AddPayloadToPing">
<Description/>
<Request/>
<Response>
<Step>
<Name>AssignMessage.AddPayloadToPing</Name>
</Step>
</Response>
<Condition>(proxy.pathsuffix MatchesPath "/_ping") and ((request.verb = "GET") or (request.verb = "HEAD"))</Condition>
<Description/>
<Request/>
<Response>
<Step>
<Name>AssignMessage.AddPayloadToPing</Name>
</Step>
</Response>
<Condition>(proxy.pathsuffix MatchesPath "/_ping") and ((request.verb = "GET") or (request.verb = "HEAD"))</Condition>
</Flow>
<Flow name="StatusEndpoint">
<Request>
<Step>
<Condition>request.header.apikey = null or private.common.status-endpoint-api-key != request.header.apikey</Condition>
<Name>RaiseFault.401Unauthorized</Name>
</Step>
<Step>
<Name>ServiceCallout.CallHealthcheckEndpoint</Name>
</Step>
</Request>
<Response>
<Step>
<Name>javascript.SetStatusResponse</Name>
</Step>
</Response>
<Condition>(proxy.pathsuffix MatchesPath "/_status") and ((request.verb = "GET") or (request.verb = "HEAD"))</Condition>
<Request>
<Step>
<Condition>request.header.apikey = null or private.common.status-endpoint-api-key != request.header.apikey</Condition>
<Name>RaiseFault.401Unauthorized</Name>
</Step>
<Step>
<Name>ServiceCallout.CallHealthcheckEndpoint</Name>
</Step>
</Request>
<Response>
<Step>
<Name>javascript.SetStatusResponse</Name>
</Step>
</Response>
<Condition>(proxy.pathsuffix MatchesPath "/_status") and ((request.verb = "GET") or (request.verb = "HEAD"))</Condition>
</Flow>
<Flow name="Raise400ForMissingODSHeader">
<Request>
<Step>
<Name>RaiseFault.400BadRequest</Name>
<Message>Missing Header: NHSD-End-User-Organisation-ODS</Message>
</Step>
</Request>
<Condition>request.verb != "OPTIONS" and (request.header.NHSD-End-User-Organisation-ODS = null or request.header.NHSD-End-User-Organisation-ODS = "")</Condition>
<Request>
<Step>
<Name>RaiseFault.400BadRequest</Name>
<Message>Missing Header: NHSD-End-User-Organisation-ODS</Message>
</Step>
</Request>
<Condition>request.verb != "OPTIONS" and (request.header.NHSD-End-User-Organisation-ODS = null or request.header.NHSD-End-User-Organisation-ODS = "")</Condition>
</Flow>
<Flow name="CorsHeaders">
<!-- This must be the last item in the flow -->
<Response>
<Step>
<Name>AssignMessage.AddCors</Name>
</Step>
</Response>
<!-- This must be the last item in the flow -->
<Response>
<Step>
<Name>AssignMessage.AddCors</Name>
</Step>
</Response>
</Flow>
</Flows>
<PreFlow>
Expand Down

0 comments on commit 566fa0b

Please sign in to comment.