js-sdk-contrib
js-sdk-contrib copied to clipboard
go-feature-flag server provider overwrites pathname
Description
The go-feature-flag-provider overwrites the endpoint path name when constructing the endpointURL. When using a relay-proxy deployed behind a load balancer that proxies traffic based on pathname, the provider is not able to send requests to the proper url.
Example provider config:
const goFeatureFlagProvider: GoFeatureFlagProvider = new GoFeatureFlagProvider( { endpoint: https://int-lb-url.com/relay-proxy, } ); OpenFeature.setProvider(goFeatureFlagProvider);
I would expect requests for flag evaluate to be requested from: https://int-lb-url.com/relay-proxy/v1/feature/${flagKey}/eval
Instead they are being requested from: https://int-lb-url.com/v1/feature/${flagKey}/eval
Possible Cause
In the GoffApiController, the built URL is overwriting the pathname of the URL.
https://github.com/open-feature/js-sdk-contrib/blob/main/libs/providers/go-feature-flag/src/lib/controller/goff-api.ts#L64
This is not the same behavior used in the go-feature-flag-web provider, which appends the relay-proxy pathnames to any existing base endpoint provider to the provider.