Skip to content

Commit 58f9471

Browse files
author
igba.ujege
committed
Added capture proxy to sandbox
1 parent aa1021b commit 58f9471

3 files changed

Lines changed: 12 additions & 0 deletions

File tree

proxies/sandbox/apiproxy/policies/javascript.CaptureproxyHostName.xml renamed to proxies/sandbox/apiproxy/policies/javascript.CaptureProxyHostName.xml

File renamed without changes.

proxies/sandbox/apiproxy/proxies/default.xml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@
3838
<Condition>(proxy.pathsuffix MatchesPath "/_status") and ((request.verb = "GET") or (request.verb = "HEAD"))
3939
</Condition>
4040
</Flow>
41+
<Flow name="CaptureProxyHostName">
42+
<Request>
43+
<Step>
44+
<Condition>(proxy.pathsuffix != "/_status") and (proxy.pathsuffix != "/_ping")</Condition>
45+
<Name>javascript.CaptureProxyHostName</Name>
46+
</Step>
47+
</Request>
48+
</Flow>
4149
</Flows>
4250
<PreFlow/>
4351
<PostClientFlow name="PostClientFlow">
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
const env_regex = /^([a-zA-Z0-9-]+\.)?api\.service\.nhs\.uk/gm;
2+
var hostname_env = request.headers.host;
3+
hostname_env = hostname_env.match(env_regex, request.headers.host)[0];
4+
context.setVariable("request_hostname_env", hostname_env);

0 commit comments

Comments
 (0)