This document helpfully gives guidance for setting up a domain proxy in order to avoid issues with blockers: https://www.docs.developers.amplitude.com/analytics/domain-proxy/
We are following this procedure, however, I’m confused about two points in this doc. The first is where it says:
The HTTP API uses a slightly different endpoint from the SDKs, so to test, you need to temporarily set
proxy_pass
tohttps://api2.amplitude.com/2/httpapi/
.
This implies /2/httpapi
should not be final long-term value of the proxy pass, and is only temporary for testing. So what should the actual value be??
Second, it says later, in the SDK configuration section:
The SDK's don't point to the same API endpoint as the HTTP API V2, but rather a special endpoint for its custom payloads. Send them instead to
https://api2.amplitude.com/
Which is again confusing because obviously the client SDK should not be configured to send events to amplitude’s domain, the entire purpose of the proxy is to avoid that and use our own domain. The SDK obviously should be configured to use our proxy endpoint, so can someone clarify what this is really saying?
I find that if I use the /2/httpapi
path in the proxy pass, it seems to work. Without that path, it does not. /batch
seems to work, also, but this is not mentioned anywhere. I am doubting that I’ve done it correctly given these two confusing statements. I’m just trying to proxy the network requests the @amplitude/analytics-browser
npm module makes.
Thanks!