Skip to content

Commit 62e7b28

Browse files
authored
Merge pull request #6331 from segmentio/niall/add_proxy_info
Update proxy info
2 parents b223d33 + f4f2f9b commit 62e7b28

File tree

1 file changed

+22
-2
lines changed

1 file changed

+22
-2
lines changed

src/connections/sources/catalog/libraries/mobile/kotlin-android/kotlin-android-faq.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,5 +83,25 @@ When you successfully package a plugin in device-mode, you will no longer see th
8383
## What is the instanceId set in context?
8484
The instanceId was introduced in [V 1.10.1](https://github.com/segmentio/analytics-kotlin/releases/tag/1.10.1){:target="_blank"} and correlates events to a particular instance of the client in a scenario when you might have multiple instances on a single app.
8585

86-
## If I use a proxy, what Segment endpoint should I send to?
87-
If you proxy your events through the `apiHost` config option, you must forward the batched events to `https://api.segment.io/v1/b`. The `https://api.segment.io/v1/batch` endpoint is reserved for events arriving from server side sending, and proxying to that endpoint for your mobile events may result in unexpected behavior.
86+
## How should I configure my proxy URL?
87+
To proxy events to Segment's API, you can configure your proxy URL via the `requestFactory` setting:
88+
```
89+
Analytics(BuildConfig.SEGMENT_WRITE_KEY, androidContext()) {
90+
trackApplicationLifecycleEvents = true
91+
defaultSettings = Settings(
92+
integrations = emptyJsonObject
93+
)
94+
requestFactory = object : RequestFactory() {
95+
96+
override fun settings(cdnHost: String, writeKey: String): HttpURLConnection {
97+
return super.settings("cdn-segment.test.com/v1", writeKey)
98+
}
99+
100+
override fun upload(apiHost: String): HttpURLConnection {
101+
return super.upload("api-segment.test.com/v1")
102+
}
103+
}
104+
}
105+
```
106+
107+
When proxying your events, you must forward the batched events to `https://api.segment.io/v1/b`. The `https://api.segment.io/v1/batch` endpoint is reserved for events arriving from server side sending, and proxying to that endpoint for your mobile events may result in unexpected behavior.

0 commit comments

Comments
 (0)