onaio / fhir-gateway-extension

This repo holds the OpenSRP permissions checker and data access checker
Other
0 stars 1 forks source link

Add FHIR Headers to the custom endpoints #51

Closed lincmba closed 4 months ago

lincmba commented 4 months ago

Currently, the gateway-extensions serves as a proxy to the jpa-server, managing both API requests to the jpa-server and implementing custom endpoints (/LocationHierarchy, /PractitionerDetails). While this setup seamlessly supports Android applications, it encounters issues when used with web applications (FHIR web).

Problem

Requests sent directly to the jpa-server return appropriate headers, including CORS headers. However, custom endpoints lack these headers, resulting in CORS errors on the FHIR web.

Previous Attempt

A solution was attempted at the Nginx level (PR #7982), which successfully added headers to custom endpoints but led to duplicate headers on non-custom FHIR endpoints, causing CORS errors on the FHIR web.

Proposed Solution

Handle the header issue at the gateway-extensions application level to ensure consistency in headers returned by both custom and non-custom FHIR endpoints.