Skip to content

The proxy URL is being altered in version 2.20.4, resulting in an invalid URL #1051

@roni-castro-shipt

Description

@roni-castro-shipt
  • analytics-react-native version: 2.20.4
  • Integrations versions (if used): @segment/sovran-react-native: 1.1.3
  • React Native version: 0.76.7
  • iOS or Android or both? both

Steps to reproduce

  1. Create a config passing a proxy in a specific URL. Used https://some-proxy-host/endpoint as an example in this case.
analytics = createClient({
    debug: true,
    writeKey: SEGMENT_ANALYTICS_KEY,
    proxy: 'https://some-proxy-host/endpoint'
});
  1. This getURL function adds an extra / at the end of the URL, changing my proxy URL from https://some-proxy-host/endpoint to https://some-proxy-host/endpoint/.

  2. This will cause an issue in a custom HTTP client interceptor logic because, inside that client interceptor, it concatenates ?query_param=value, and because of this change, the URL will become a malformed URL, and we will get a 404 because of the /? in https://some-proxy-host/endpoint/?query_param=value

  3. The version 2.20.4 caused this issue. 2.20.3 does not change that.

Expected behavior
If a proxy URL is passed as https://some-proxy-host/endpoint, I expect the lib not to change that.

Actual behavior
The proxy URL https://some-proxy-host/endpoint is modified by the lib to https://some-proxy-host/endpoint/

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions