Use case/Problem Statement
LocationHierarchy and PractitionerDetail are not FHIR resources; they are custom endpoints on the fhir-gateway-extension. The gateway serves them at the root, as a plain GET:
GET /LocationHierarchy?_id=<id>
GET /PractitionerDetail?keycloak-uuid=<id>
But fhir-web currently requests them like any normal FHIR resource, which produces the wrong URL in two ways:
GET /fhir/LocationHierarchy/_search?_id=<id>
^^^^^ ^^^^^^^
1. extra /fhir prefix 2. extra /_search suffix
Both are wrong for these endpoints:
- The
/fhir prefix comes from REACT_APP_FHIR_API_BASE_URL. Custom endpoints live at the gateway root, not under /fhir.
- The
/_search suffix is added by the shared FHIR client's list() method. The gateway expects a plain GET with query params.
Because the request has the /fhir prefix, the gateway forwards it to the backend HAPI FHIR server instead of the custom endpoint handler.
HAPI then rejects it, responding that LocationHierarchy is not a known/supported resource type (an OperationOutcome error), since it isn't a real FHIR resource.
Result: the location hierarchy tree and practitioner details fail to load when fhir-web points at the fhir-gateway-extension.
Acceptance criteria
Make custom-endpoint calls use GET {gatewayRoot}/{Endpoint}?... (no /fhir, no /_search), with the base URL configurable.
-
Add a base-URL resolver for custom endpoints that strips a trailing /fhir (or uses an explicit override).
packages/react-utils/src/helpers/utils.tsx → getFhirCustomEndpointBaseURL()
-
Add a config option for the custom-endpoint base, defaulting to the FHIR base with /fhir removed.
app/src/configs/env.ts → REACT_APP_FHIR_WEB_CUSTOM_ENDPOINT_BASE_URL
- thread it through app props in
app/src/App/utils.tsx
-
Fix the LocationHierarchy call to use the resolved base and a plain GET (via the existing FHIRServiceClass.customRequest, not list()).
packages/fhir-location-management/src/helpers/utils.ts → useGetLocationHierarchy
- callers:
LocationUnitList, AddEditLocationUnit, OrganizationAffiliation
-
Fix the PractitionerDetail call the same way.
packages/fhir-keycloak-user-management/src/components/UserList/Viewdetails/index.tsx
-
Update tests, env samples, and docs to match the new request URLs and the new config option.
Project Contact
No response
Relevant Information
https://github.com/onaio/fhir-gateway-extension#custom-endpoints
Use case/Problem Statement
LocationHierarchyandPractitionerDetailare not FHIR resources; they are custom endpoints on the fhir-gateway-extension. The gateway serves them at the root, as a plain GET:But fhir-web currently requests them like any normal FHIR resource, which produces the wrong URL in two ways:
Both are wrong for these endpoints:
/fhirprefix comes fromREACT_APP_FHIR_API_BASE_URL. Custom endpoints live at the gateway root, not under/fhir./_searchsuffix is added by the shared FHIR client'slist()method. The gateway expects a plainGETwith query params.Because the request has the
/fhirprefix, the gateway forwards it to the backend HAPI FHIR server instead of the custom endpoint handler.HAPI then rejects it, responding that
LocationHierarchyis not a known/supported resource type (anOperationOutcomeerror), since it isn't a real FHIR resource.Result: the location hierarchy tree and practitioner details fail to load when fhir-web points at the fhir-gateway-extension.
Acceptance criteria
Make custom-endpoint calls use
GET {gatewayRoot}/{Endpoint}?...(no/fhir, no/_search), with the base URL configurable.Add a base-URL resolver for custom endpoints that strips a trailing
/fhir(or uses an explicit override).packages/react-utils/src/helpers/utils.tsx→getFhirCustomEndpointBaseURL()Add a config option for the custom-endpoint base, defaulting to the FHIR base with
/fhirremoved.app/src/configs/env.ts→REACT_APP_FHIR_WEB_CUSTOM_ENDPOINT_BASE_URLapp/src/App/utils.tsxFix the LocationHierarchy call to use the resolved base and a plain GET (via the existing
FHIRServiceClass.customRequest, notlist()).packages/fhir-location-management/src/helpers/utils.ts→useGetLocationHierarchyLocationUnitList,AddEditLocationUnit,OrganizationAffiliationFix the PractitionerDetail call the same way.
packages/fhir-keycloak-user-management/src/components/UserList/Viewdetails/index.tsxUpdate tests, env samples, and docs to match the new request URLs and the new config option.
Project Contact
No response
Relevant Information
https://github.com/onaio/fhir-gateway-extension#custom-endpoints