Skip to content

Commit 3d86539

Browse files
committed
add proxy issues
1 parent 712c9f2 commit 3d86539

File tree

1 file changed

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

1 file changed

+54
-0
lines changed

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

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,60 @@ To add a CNAME record to your DNS settings:
178178
3. Save your record. This might take some time to take effect, depending on your TTL settings.
179179
4. Run `curl` on your domain to check if the proxy is working correctly.
180180

181+
## Common issues
182+
183+
These are some common issues that occur for cusotmers implemtning a cusotm proxy. This not an exhaustive list, and these settings may change in CloudFront or CloudFlare over time.
184+
185+
#### CloudFlare returning a 403 error
186+
187+
There are two ways of configuring the CDN distribution in Cloudflare and the 403 error is an indication that one of the below options is misconfigured:
188+
189+
1. If you have a CloudFlare enterprise plan then create a Page Rule in Cloudflare so that Segment's CDN wouldn't refuse the requests via the Cloudflare Proxy.
190+
191+
If cdn.segment.com is another CNAME, which resolves to xxx.cloudfront.net, you will need to use a Page Rule in Cloudflare to override the host header to match the hostname for proxy requests.
192+
193+
More in Cloudflare’s docs on overriding the host header can be found [here](https://developers.cloudflare.com/rules/page-rules/how-to/rewrite-host-headers/).
194+
195+
196+
2. For customers who are not on the Cloudflare Enterprise plan, use the CloudFlare Workers. Workers usually can run on the main domain www.domain.com but if you want to http://segment.domain.com it needs to be in your DNS like [this](https://developers.cloudflare.com/workers/platform/routes#subdomains-must-have-a-dns-record).
197+
198+
When creating the worker you can use this example provided by [CloudFlare](https://developers.cloudflare.com/workers/examples/bulk-origin-proxy) with the origins set to:
199+
200+
```ts
201+
const ORIGINS = {
202+
"yourcdndomain.com": "cdn.segment.com",
203+
}
204+
```
205+
206+
#### CloudFlare CORS issue
207+
208+
In order to resolve a CORS OPTIONS pre-request fetch error, you’ll have to specify "Strict (SSL-Only Origin Pull)" as a Cloudflare Page rule for the api.segment.io proxy. Please see CloudFlare [documentation](https://support.cloudflare.com/hc/en-us/articles/200170416-End-to-end-HTTPS-with-Cloudflare-Part-3-SSL-options#h_065d742e-8c0b-4ed4-8fb5-037e10fe5f9a) on this process.
209+
210+
#### CloudFront returning a 403 error
211+
212+
If your CloudFront Proxy is returing a 403 error, the following change in CloudFront may solve the issue:
213+
214+
```ts
215+
Before:
216+
Cache Based on Selected Request Headers: All
217+
218+
After:
219+
Cache Based on Selected Request Headers: None
220+
```
221+
222+
Alternatively, this setting may solve your issue:
223+
224+
```ts
225+
Before:
226+
Origin request policy: AllViewer
227+
228+
After:
229+
Origin request policy: None
230+
```
231+
232+
### CloudFront CORS issue
233+
234+
To resolve a CORS issue you may need to follow this [CloudFront](https://aws.amazon.com/premiumsupport/knowledge-center/no-access-control-allow-origin-error/) guide which outlines adding a referrer header in the request sent to Segment.
181235

182236
## Self-hosting Analytics.js
183237

0 commit comments

Comments
 (0)