Skip to content

Commit 08d163c

Browse files
Update custom-proxy.md
1 parent da21430 commit 08d163c

File tree

1 file changed

+38
-0
lines changed
  • src/connections/sources/catalog/libraries/website/javascript

1 file changed

+38
-0
lines changed

src/connections/sources/catalog/libraries/website/javascript/custom-proxy.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ You need to set up two important parts, regardless of the CDN provider you use:
3030
3131
## Set up
3232

33+
**Option 1**
34+
3335
Follow the directions listed for CloudFront or use your own CDN setup. Once you complete those steps and verify that your proxy works for both `cdn.segment.com` and `api.segment.io`, [contact Segment Product Support](https://segment.com/help/contact/) with the following template email:
3436

3537
```text
@@ -51,6 +53,42 @@ A Segment Customer Success team member will respond that they have enabled this
5153
> info ""
5254
> The **Host Address** field does not appear in source settings until it's enabled by Segment Customer Success.
5355
56+
**Option 2**
57+
58+
## Custom CDN / API Proxy
59+
60+
You can proxy settings and destination requests that typically go to `http://cdn.segment.com` through a custom proxy.
61+
62+
```ts
63+
const analytics = AnalyticsBrowser.load({
64+
writeKey,
65+
// GET http://cdn.segment.com/v1/projects/<writekey>/settings ->
66+
// https://MY-CUSTOM-CDN-PROXY.com/v1/project/<writekey>/settings
67+
// GET https://cdn.segment.com/next-integrations/actions/...js ->
68+
// https://MY-CUSTOM-CDN-PROXY.com/next-integrations/actions/...js
69+
cdnURL: 'https://MY-CUSTOM-CDN-PROXY.com' //
70+
})
71+
```
72+
73+
You can proxy event calls that typically go to `https://api.segment.io` by configuring `integrations['Segment.io'].apiHost`.
74+
```ts
75+
const analytics = AnalyticsBrowser.load(
76+
{
77+
writeKey,
78+
cdnURL: 'https://MY-CUSTOM-CDN-PROXY.com'
79+
},
80+
{
81+
integrations: {
82+
'Segment.io': {
83+
// POST https://api.segment.io/v1/t ->
84+
// https://MY-CUSTOM-API-PROXY.com/v1/t
85+
apiHost: 'MY-CUSTOM-API-PROXY.com' //
86+
}
87+
}
88+
}
89+
)
90+
```
91+
5492
## CloudFront
5593

5694
These instructions refer to Amazon CloudFront, but apply more generally to other providers as well.

0 commit comments

Comments
 (0)