Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SEGMENT_API_HOST integrations['Segment.io'].apiHost cannot hit current host #1198

Open
ewah opened this issue Nov 25, 2024 · 1 comment
Open

Comments

@ewah
Copy link

ewah commented Nov 25, 2024

To solve 3rd party script issues we want to proxy our own api.segment.io calls

We're ok having it on the same fqdn and routing back w/ nginx/cloudflare/cloudfront/etc.

But it looks like .send() does not give us an opportunity to put in send it as the same
originating domain.

would love for SEGMENT_API_HOST/apiHost just take "/v1", "/segment/v1"

  const apiHost = settings?.apiHost ?? SEGMENT_API_HOST
  const protocol = settings?.protocol ?? 'https'
  const remote = `${protocol}://${apiHost}`
  ....
  
    return client
      .dispatch(
        `${remote}/${path}`,
        normalize(analytics, json, settings, integrations)
      )
      .then(() => ctx)
  
@ewah
Copy link
Author

ewah commented Nov 25, 2024

just a note cdnURL will take in '' and '/segment' as prefixes to the current fqdn

export function loadLegacySettings(
  writeKey: string,
  cdnURL?: string
): Promise<LegacySettings> {
  const baseUrl = cdnURL ?? getCDN()

  return fetch(`${baseUrl}/v1/projects/${writeKey}/settings`)

@ewah ewah changed the title SEGMENT_API_HOST integrations[''Segment.io'].apiHost cannot hit current host SEGMENT_API_HOST integrations['Segment.io'].apiHost cannot hit current host Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant