diff --git a/proxies/live/apiproxy/policies/javascript.RemoveFHIRPath.xml b/proxies/live/apiproxy/policies/javascript.RemoveFHIRPath.xml
new file mode 100644
index 0000000..dbff69f
--- /dev/null
+++ b/proxies/live/apiproxy/policies/javascript.RemoveFHIRPath.xml
@@ -0,0 +1,6 @@
+
+
+ javascript.RemoveFHIRPath
+
+ jsc://RemoveFHIRPath.js
+
diff --git a/proxies/live/apiproxy/resources/jsc/RemoveFHIRPath.js b/proxies/live/apiproxy/resources/jsc/RemoveFHIRPath.js
new file mode 100644
index 0000000..2df2cd3
--- /dev/null
+++ b/proxies/live/apiproxy/resources/jsc/RemoveFHIRPath.js
@@ -0,0 +1,15 @@
+// Get current proxy URL
+var proxyUrl = context.getVariable("proxy.url");
+
+// Check if the proxy URL contains '/FHIR/R4/' string
+if (proxyUrl.includes('/FHIR/R4/')) {
+ // Disable copy path
+ context.setVariable("target.copy.pathsuffix", false);
+
+ // Replace string in incoming proxy URL path
+ var proxyUrlReplaced = proxyUrl.replace('/FHIR/R4/', '/');
+ print("Replaced: " + proxyUrlReplaced)
+
+ // Replace outgoing url
+ context.setVariable("target.url", proxyUrlReplaced);
+}
diff --git a/proxies/live/apiproxy/targets/target.xml b/proxies/live/apiproxy/targets/target.xml
index d4f004b..4eab70e 100644
--- a/proxies/live/apiproxy/targets/target.xml
+++ b/proxies/live/apiproxy/targets/target.xml
@@ -16,6 +16,9 @@
AddUserNHSNumber
+
+ javascript.RemoveFHIRPath
+
diff --git a/proxies/sandbox/apiproxy/targets/sandbox.xml b/proxies/sandbox/apiproxy/targets/sandbox.xml
index a2c4a0b..cdb4591 100644
--- a/proxies/sandbox/apiproxy/targets/sandbox.xml
+++ b/proxies/sandbox/apiproxy/targets/sandbox.xml
@@ -7,10 +7,11 @@
-
+
FlowCallout.ApplyRateLimiting
+
AssignMessage.AddCors
diff --git a/sandbox/api/app.py b/sandbox/api/app.py
index 4daeaaa..5f7de26 100644
--- a/sandbox/api/app.py
+++ b/sandbox/api/app.py
@@ -21,7 +21,7 @@ def health() -> dict:
}
-@app.route("/FHIR/R4/RelatedPerson", methods=["GET"])
+@app.route("/RelatedPerson", methods=["GET"])
def get_related_persons() -> Union[dict, tuple]:
"""Sandbox API for GET /RelatedPerson