Skip to content

Commit 7220d95

Browse files
author
Niall Brennan
committed
update proxy info
1 parent 84a2c3d commit 7220d95

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

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

Lines changed: 21 additions & 1 deletion
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?
86+
## How should I configure my proxy URL?
87+
To proxy events to Segment's API, you can confiuge 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+
87107
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.

0 commit comments

Comments
 (0)