You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -13,8 +13,9 @@ To set up a custom domain, you need:
13
13
1. Access to your site DNS settings
14
14
2. A CDN you can serve assets from
15
15
3. Access to the CDN settings
16
+
4. A security certificate for the proxy domain
16
17
17
-
This guide explains how to set up a custom domain in CloudFront. The same principles can be applied to almost any modern CDN that supports proxies.
18
+
This guide explains how to set up a custom domain in CloudFront. You can apply these principles to almost any modern CDN that supports proxies.
18
19
19
20
You need to set up two important parts, regardless of the CDN provider you use:
20
21
@@ -36,146 +37,61 @@ This is {person} from {company}. I would like to configure a proxy for the follo
36
37
37
38
Double-check the source link, the Source ID, and the API proxy host to make sure they are correct.
38
39
39
-
A Segment Customer Success team member will respond that they have enabled this option for your account. When you receive this confirmation, open the source in your workspace, and navigate to Settings > Analytics.j. Modify the **Host Address** setting from `api.segment.io/v1` to `[your proxy host]/v1`.
40
+
A Segment Customer Success team member will respond that they have enabled this option for your account. When you receive this confirmation, open the source in your workspace, and navigate to Settings > Analytics.j. Update the **Host Address** setting from `api.segment.io/v1` to `[your proxy host]/v1`.
40
41
41
42
> info ""
42
-
> The **Host Address** field does not appear in source settings until it is enabled by Segment Customer Success.
43
+
> The **Host Address** field does not appear in source settings until it's enabled by Segment Customer Success.
43
44
44
45
## CloudFront
45
46
47
+
These instructions refer to Amazon CloudFront, but apply more generally to other providers as well.
48
+
46
49
### CDN Proxy
47
50
48
-
First log in to AWS and navigate to CloudFront.
49
-
50
-

51
-
52
-
Click **Create Distribution**.
53
-
54
-
Select a delivery method for your content. Click **Get Started** in the **Web** section.
55
-
56
-

57
-
58
-
Next, configure the distribution settings. Under Origin Settings, update the following values:
59
-
60
-

61
-
62
-
<table>
63
-
<tr>
64
-
<td>**Field**</td>
65
-
<td>**Value**</td>
66
-
<td>**Description**</td>
67
-
</tr>
68
-
<tr>
69
-
<td>Origin Domain Name</td>
70
-
<td>`cdn.segment.com`</td>
71
-
<td>The domain name you want the proxy to be served to</td>
72
-
</tr>
73
-
<tr>
74
-
<td>Origin ID (optional)</td>
75
-
<td>The Segment CDN</td>
76
-
<td>A Description of the origin. This can be anything you want that describes the origin domain name.</td>
77
-
</tr>
78
-
<tr>
79
-
<td>Origin Protocol Policy</td>
80
-
<td>Set to `HTTPS Only`</td>
81
-
<td></td>
82
-
</tr>
83
-
<tr>
84
-
<td>Alternate Domain Names (CNAMEs)</td>
85
-
<td>`analytics.yourdomain.com`</td>
86
-
<td>Enter the subdomain you are using as a proxy to Segment. If you don't do this you will get an error.</td>
87
-
</tr>
88
-
</table>
89
-
90
-
Next, configure the **Default Cache Behavior Settings**.
91
-
92
-
<table>
93
-
<tr>
94
-
<td>**Field**</td>
95
-
<td>**Value**</td>
96
-
<td>**Description**</td>
97
-
</tr>
98
-
<tr>
99
-
<td>Viewer Protocol Policy</td>
100
-
<td>Redirect HTTP to HTTPS</td>
101
-
<td>Ensure that all traffic goes through HTTPS</td>
102
-
</tr>
103
-
<tr>
104
-
<td>Allowed HTTP Methods</td>
105
-
<td>GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE</td>
106
-
<td>Select which HTTP methods are allowed to be proxied.</td>
107
-
</tr>
108
-
<tr>
109
-
<td>Forward Cookies</td>
110
-
<td>All</td>
111
-
<td>Ensure that cookies are forwarded.</td>
112
-
</tr>
113
-
<tr>
114
-
<td>Query String Forwarding and Caching</td>
115
-
<td>Forward all, cache based on all</td>
116
-
<td>Ensure that all query string values are forwarded and properly cached.</td>
117
-
</tr>
118
-
</table>
119
-
120
-
Click **Create Distribution** at the bottom of the page. This distribution displays as being "In Progress" until it finishes deploying.
121
-
122
-
You need the "Domain Name" for the next step, so keep this browser window open.
51
+
1. First log in to the AWS console and navigate to CloudFront.
52
+
2. Click **Create Distribution**.
53
+
3. Configure the distribution settings. In the Origin section, update the following values:
54
+
-**Origin Domain Name**: `cdn.segment.com`
55
+
-**Protocol**: `HTTPS only`
56
+
4. In the Default cache behavior section, configure the following values:
57
+
-**Viewer protocol policy**: `Redirect HTTP to HTTPS`
58
+
-**Allowed HTTP Methods**: `GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE`
59
+
5. In the Settings section, configure the following values:
60
+
-**Alternate domain name (CNAME)**: `analytics.<yourdomain>.com`
61
+
-**Custom SSL certificate**: Select an existing or select a new certificate to validate the authorization to use the **Alternate domain name (CNAME)** value. For more information, see Amazon's documentation [Requirements for using alternate domain names](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html#alternate-domain-names-requirements){:target="_blank"}
62
+
6. Click **Create Distribution**.
63
+
64
+
Take note of the Domain Name, for use in the next step.
123
65
124
66
#### Add CNAME Record to DNS
125
67
126
68
Next, add a CNAME record for the Segment proxy to your organizations DNS settings. Use a name that makes it clear what you are using the subdomain for, for example `analytics.mysite.com`. Go to your domain registrar and add a new record to your DNS of type "CNAME".
127
69
128
-
<table>
129
-
<tr>
130
-
<td>**Field**</td>
131
-
<td>**Value**</td>
132
-
</tr>
133
-
<tr>
134
-
<td>Name</td>
135
-
<td>{subdomain_name}.yourdomain.com</td>
136
-
</tr>
137
-
<tr>
138
-
<td>Value</td>
139
-
<td>CloudFront Distribution Domain Name</td>
140
-
</tr>
141
-
</table>
142
-
143
-
Save your record. This might take some time to take effect, depending on your TTL settings. Make a `curl` request to your domain to verify that it's proxying correctly.
Save your record. This might take some time to take effect, depending on your TTL settings. Make a `curl` request to your domain to verify that the proxy works.
144
77
145
78
### Tracking API Proxy
146
79
147
-
Next, set up a proxy for the tracking API so that all calls are proxied through your domain. In this step, we set up a CloudFront distribution that's very similar to the previous step, with a few minor changes:
148
-
149
-
<table>
150
-
<tr>
151
-
<td>**Field**</td>
152
-
<td>**Value**</td>
153
-
<td>**Description**</td>
154
-
</tr>
155
-
<tr>
156
-
<td>Origin Domain Name</td>
157
-
<td>`api.segment.io`</td>
158
-
<td>The domain name you would like the proxy to be served to</td>
159
-
</tr>
160
-
</table>
80
+
Next, set up a proxy for the tracking API so that all calls proxy through your domain. In this step, set up a CloudFront distribution that's similar to the previous step, with the exception of the Origin Domain Name:
| Origin Domain Name |`api.segment.io`| The domain name to which the proxy is served |
85
+
161
86
162
87
#### Add CNAME Record to DNS
163
88
164
89
Next, add a CNAME record to your DNS settings. Go to your domain registrar and add a new record to your DNS of type "CNAME". This time use the CloudFront distribution for the tracking API proxy.
165
90
166
-
<table>
167
-
<tr>
168
-
<td>**Field**</td>
169
-
<td>**Value**</td>
170
-
</tr>
171
-
<tr>
172
-
<td>Name</td>
173
-
<td>{subdomain_name}.yourdomain.com</td>
174
-
</tr>
175
-
<tr>
176
-
<td>Value</td>
177
-
<td>Tracking API CloudFront Distribution Domain Name</td>
| Value |*Tracking API CloudFront Distribution Domain Name*|
95
+
180
96
181
97
Save your record. This might take some time to take effect, depending on your TTL settings. Try running `curl` on your domain to check if the proxy is working correctly.
0 commit comments