onaio / fhir-gateway-extension

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

Switch to HTTP POST for FHIR Search Requests #73

Closed lincmba closed 2 months ago

lincmba commented 2 months ago

Description

Currently, the gateway-extension service sends search requests to FHIR JPA servers using HTTP GET. However, these requests can result in URLs that are too long, causing the server to return a 414 Request-URI Too Large error.

Previously, we handled this issue by increasing the nginx large_client_header_buffers value. However, this solution only works for servers with ingress enabled. The server-snippet is specifically an NGINX ingress controller annotation, so it wouldn’t be applicable if we're not using the ingress controller hence we cannot adjust the large_client_header_buffers setting when ingress.enabled is set to false.

To resolve this, we will switch to using HTTP POST for search requests. This change will ensure that search parameters are transmitted in the request body instead of the URL, preventing the 414 error and giving us better control within the gateway-extension application.

Implementation Details

Example Implementation

response = client.search()
      .forResource("Patient")
      .where(Patient.NAME.matches().value("Tester"))
      .usingStyle(SearchStyleEnum.POST)
      .returnBundle(Bundle.class)
      .execute();

Acceptance Criteria

Additional Information

Related issues

https://github.com/onaio/fhir-gateway-extension/issues/69