Skip to content

Commit 0042b17

Browse files
Merge pull request #7029 from segmentio/niall/proxy_faq
Add common questions about custom proxy setup
2 parents 37ec7d0 + ae968d9 commit 0042b17

File tree

1 file changed

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

1 file changed

+50
-0
lines changed

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

+50
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,56 @@ 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 customers implementing a custom proxy. This not an exhaustive list, and these CloudFront or CloudFlare settings may change.
184+
185+
#### CloudFlare returning a 403 error
186+
187+
When you encounter a 403 error, can mean that you've misconfigured your CloudFlare CDN distribution. Try one of the following options to fix the error:
188+
189+
1. If you have a CloudFlare enterprise plan, create a Page Rule in CloudFlare so that Segment's CDN doesn't refuse the requests made through the CloudFlare Proxy. If cdn.segment.com is another CNAME that 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. For more information about overriding the host header, see CloudFlare’s [Rewrite Host headers](https://developers.cloudflare.com/rules/page-rules/how-to/rewrite-host-headers/){:target="_blank”} docs.
190+
191+
192+
2. For customers who are not on the CloudFlare Enterprise plan, use CloudFlare Workers. Workers usually run on the main domain (for example, `www.domain.com`), but if you want Workers to run on a subdomain, like `http://segment.domain.com`, you must record the subdomain in your DNS. For more information, see CloudFlare's [Routes and domains](https://developers.cloudflare.com/workers/platform/routes#subdomains-must-have-a-dns-record){:target="_blank”} documentation.
193+
194+
When creating a Worker you can use this example provided by CloudFlare in their [Bulk origin override](https://developers.cloudflare.com/workers/examples/bulk-origin-proxy){:target="_blank”} documentation with the origins set to:
195+
196+
```ts
197+
const ORIGINS = {
198+
"yourcdndomain.com": "cdn.segment.com",
199+
}
200+
```
201+
202+
#### CloudFlare CORS issue
203+
204+
In order to resolve a CORS OPTIONS pre-request fetch error, you must specify "Strict (SSL-Only Origin Pull)" as a CloudFlare Page rule for the api.segment.io proxy. Please see CloudFlare's [Encryption modes](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){:target="_blank”} documentation for more details.
205+
206+
#### CloudFront Proxy returning a 403 error
207+
208+
If your CloudFront Proxy is returing a 403 error, the following change in CloudFront might resolve the issue:
209+
210+
```ts
211+
Before:
212+
Cache Based on Selected Request Headers: All
213+
214+
After:
215+
Cache Based on Selected Request Headers: None
216+
```
217+
218+
Alternatively, this setting may solve your issue:
219+
220+
```ts
221+
Before:
222+
Origin request policy: AllViewer
223+
224+
After:
225+
Origin request policy: None
226+
```
227+
228+
### CloudFront CORS issue
229+
230+
To resolve a CORS issue, you might need to add a referrer header in the request you send to Segment. Follow AWS's [How do I resolve the "No 'Access-Control-Allow-Origin' header is present on the requested resource" error from CloudFront?](https://aws.amazon.com/premiumsupport/knowledge-center/no-access-control-allow-origin-error/){:target="_blank”} guide, which explains how to add a referrer header.
181231

182232
## Self-hosting Analytics.js
183233

0 commit comments

Comments
 (0)