@ihoomanai/chat-widget 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cdn/SRI_HASHES.md +8 -8
- package/cdn/health.json +3 -3
- package/cdn/latest/chat.js +10 -2
- package/cdn/latest/chat.js.map +1 -1
- package/cdn/latest/chat.min.js +1 -1
- package/cdn/latest/chat.min.js.map +1 -1
- package/cdn/manifest.json +10 -10
- package/cdn/v2/chat.js +10 -2
- package/cdn/v2/chat.js.map +1 -1
- package/cdn/v2/chat.min.js +1 -1
- package/cdn/v2/chat.min.js.map +1 -1
- package/cdn/{v2.0.0 → v2.0.1}/chat.js +10 -2
- package/cdn/v2.0.1/chat.js.map +1 -0
- package/cdn/{v2.0.0 → v2.0.1}/chat.min.js +1 -1
- package/cdn/{v2.0.0 → v2.0.1}/chat.min.js.map +1 -1
- package/dist/index.cjs.js +103 -17
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +103 -17
- package/dist/index.esm.js.map +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.esm.min.js.map +1 -1
- package/dist/index.umd.js +103 -17
- package/dist/index.umd.js.map +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/index.umd.min.js.map +1 -1
- package/dist/types.d.ts +3 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/widget.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/types.ts +3 -1
- package/src/widget.ts +105 -17
- package/cdn/CDN_DEPLOYMENT.md +0 -199
- package/cdn/cloudflare-config.json +0 -203
- package/cdn/cloudfront-config.json +0 -153
- package/cdn/nginx.conf +0 -185
- package/cdn/v2.0.0/chat.js.map +0 -1
package/cdn/CDN_DEPLOYMENT.md
DELETED
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
# CDN Deployment Guide
|
|
2
|
-
|
|
3
|
-
This document describes how to deploy the Ihooman Chat Widget to a CDN with proper URL structure and caching configuration.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
The widget is served from `https://cdn.ihooman.ai/widget/` with the following URL structure:
|
|
8
|
-
|
|
9
|
-
| URL Pattern | Description | Cache Duration |
|
|
10
|
-
|-------------|-------------|----------------|
|
|
11
|
-
| `/v2/chat.min.js` | Latest v2.x.x release | 1 year (immutable) |
|
|
12
|
-
| `/v2.1.0/chat.min.js` | Specific version | 1 year (immutable) |
|
|
13
|
-
| `/latest/chat.min.js` | Always latest stable | 5 minutes |
|
|
14
|
-
|
|
15
|
-
## URL Structure
|
|
16
|
-
|
|
17
|
-
### Versioned URLs (Recommended for Production)
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
https://cdn.ihooman.ai/widget/v2/chat.min.js # Latest v2.x.x
|
|
21
|
-
https://cdn.ihooman.ai/widget/v2.1.0/chat.min.js # Specific version
|
|
22
|
-
https://cdn.ihooman.ai/widget/v2.1.0/chat.min.js.map # Source map
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
### Latest URL (For Development/Testing)
|
|
26
|
-
|
|
27
|
-
```
|
|
28
|
-
https://cdn.ihooman.ai/widget/latest/chat.min.js # Always latest stable
|
|
29
|
-
https://cdn.ihooman.ai/widget/latest/chat.min.js.map # Source map
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Cache Headers
|
|
33
|
-
|
|
34
|
-
### Versioned Content (v2/, v2.1.0/, etc.)
|
|
35
|
-
|
|
36
|
-
```
|
|
37
|
-
Cache-Control: public, max-age=31536000, immutable
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
- **max-age=31536000**: Cache for 1 year (365 days)
|
|
41
|
-
- **immutable**: Content will never change, browsers can skip revalidation
|
|
42
|
-
- **public**: Can be cached by CDN edge nodes and browsers
|
|
43
|
-
|
|
44
|
-
### Latest Content (/latest/)
|
|
45
|
-
|
|
46
|
-
```
|
|
47
|
-
Cache-Control: public, max-age=300
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
- **max-age=300**: Cache for 5 minutes
|
|
51
|
-
- **public**: Can be cached by CDN edge nodes and browsers
|
|
52
|
-
- No `immutable` flag since content changes with each release
|
|
53
|
-
|
|
54
|
-
## Deployment Options
|
|
55
|
-
|
|
56
|
-
### Option 1: AWS CloudFront + S3
|
|
57
|
-
|
|
58
|
-
See `cloudfront-config.json` for CloudFront distribution configuration.
|
|
59
|
-
|
|
60
|
-
### Option 2: Cloudflare
|
|
61
|
-
|
|
62
|
-
See `cloudflare-config.json` for Cloudflare configuration.
|
|
63
|
-
|
|
64
|
-
### Option 3: Nginx (Self-Hosted)
|
|
65
|
-
|
|
66
|
-
See `nginx.conf` for Nginx configuration.
|
|
67
|
-
|
|
68
|
-
## Deployment Steps
|
|
69
|
-
|
|
70
|
-
### 1. Build CDN Assets
|
|
71
|
-
|
|
72
|
-
```bash
|
|
73
|
-
cd packages/chat-widget
|
|
74
|
-
npm run build:cdn
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
This generates:
|
|
78
|
-
- `cdn/v2/` - Major version directory
|
|
79
|
-
- `cdn/v2.x.x/` - Full version directory
|
|
80
|
-
- `cdn/latest/` - Latest version directory
|
|
81
|
-
- `cdn/manifest.json` - Build manifest with SRI hashes
|
|
82
|
-
|
|
83
|
-
### 2. Upload to CDN Origin
|
|
84
|
-
|
|
85
|
-
Upload the contents of the `cdn/` directory to your CDN origin (S3, R2, or origin server).
|
|
86
|
-
|
|
87
|
-
```bash
|
|
88
|
-
# Example: AWS S3
|
|
89
|
-
aws s3 sync cdn/ s3://cdn-ihooman-widget/widget/ \
|
|
90
|
-
--cache-control "public, max-age=31536000, immutable" \
|
|
91
|
-
--exclude "latest/*"
|
|
92
|
-
|
|
93
|
-
aws s3 sync cdn/latest/ s3://cdn-ihooman-widget/widget/latest/ \
|
|
94
|
-
--cache-control "public, max-age=300"
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
### 3. Invalidate CDN Cache (if updating)
|
|
98
|
-
|
|
99
|
-
```bash
|
|
100
|
-
# AWS CloudFront
|
|
101
|
-
aws cloudfront create-invalidation \
|
|
102
|
-
--distribution-id YOUR_DISTRIBUTION_ID \
|
|
103
|
-
--paths "/widget/latest/*" "/widget/v2/*"
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
### 4. Verify Deployment
|
|
107
|
-
|
|
108
|
-
```bash
|
|
109
|
-
# Check versioned URL
|
|
110
|
-
curl -I https://cdn.ihooman.ai/widget/v2.0.0/chat.min.js
|
|
111
|
-
|
|
112
|
-
# Expected headers:
|
|
113
|
-
# Cache-Control: public, max-age=31536000, immutable
|
|
114
|
-
# Content-Type: application/javascript
|
|
115
|
-
|
|
116
|
-
# Check latest URL
|
|
117
|
-
curl -I https://cdn.ihooman.ai/widget/latest/chat.min.js
|
|
118
|
-
|
|
119
|
-
# Expected headers:
|
|
120
|
-
# Cache-Control: public, max-age=300
|
|
121
|
-
# Content-Type: application/javascript
|
|
122
|
-
```
|
|
123
|
-
|
|
124
|
-
## CORS Configuration
|
|
125
|
-
|
|
126
|
-
The CDN must allow cross-origin requests for the widget to work on any domain:
|
|
127
|
-
|
|
128
|
-
```
|
|
129
|
-
Access-Control-Allow-Origin: *
|
|
130
|
-
Access-Control-Allow-Methods: GET, HEAD, OPTIONS
|
|
131
|
-
Access-Control-Allow-Headers: Content-Type
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
## Security Headers
|
|
135
|
-
|
|
136
|
-
Recommended security headers for the CDN:
|
|
137
|
-
|
|
138
|
-
```
|
|
139
|
-
X-Content-Type-Options: nosniff
|
|
140
|
-
X-Frame-Options: DENY
|
|
141
|
-
Referrer-Policy: strict-origin-when-cross-origin
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
## Monitoring
|
|
145
|
-
|
|
146
|
-
### Key Metrics to Monitor
|
|
147
|
-
|
|
148
|
-
1. **Cache Hit Ratio**: Should be >95% for versioned URLs
|
|
149
|
-
2. **Latency**: P99 should be <100ms globally
|
|
150
|
-
3. **Error Rate**: Should be <0.1%
|
|
151
|
-
4. **Bandwidth**: Track for cost optimization
|
|
152
|
-
|
|
153
|
-
### Health Check Endpoint
|
|
154
|
-
|
|
155
|
-
Create a health check at `/widget/health.json`:
|
|
156
|
-
|
|
157
|
-
```json
|
|
158
|
-
{
|
|
159
|
-
"status": "healthy",
|
|
160
|
-
"version": "2.0.0",
|
|
161
|
-
"timestamp": "2024-01-01T00:00:00Z"
|
|
162
|
-
}
|
|
163
|
-
```
|
|
164
|
-
|
|
165
|
-
## Rollback Procedure
|
|
166
|
-
|
|
167
|
-
If a deployment causes issues:
|
|
168
|
-
|
|
169
|
-
1. **For versioned URLs**: Deploy the previous version to the major version directory
|
|
170
|
-
2. **For latest URL**: Update the latest directory to point to the previous stable version
|
|
171
|
-
|
|
172
|
-
```bash
|
|
173
|
-
# Rollback latest to v2.0.0
|
|
174
|
-
aws s3 sync s3://cdn-ihooman-widget/widget/v2.0.0/ \
|
|
175
|
-
s3://cdn-ihooman-widget/widget/latest/ \
|
|
176
|
-
--cache-control "public, max-age=300"
|
|
177
|
-
|
|
178
|
-
# Invalidate latest cache
|
|
179
|
-
aws cloudfront create-invalidation \
|
|
180
|
-
--distribution-id YOUR_DISTRIBUTION_ID \
|
|
181
|
-
--paths "/widget/latest/*"
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
## Version Management
|
|
185
|
-
|
|
186
|
-
### Semantic Versioning
|
|
187
|
-
|
|
188
|
-
- **Major version (v2/)**: Updated only for breaking changes
|
|
189
|
-
- **Minor/Patch versions (v2.1.0/)**: Immutable, never updated
|
|
190
|
-
- **Latest**: Always points to the most recent stable release
|
|
191
|
-
|
|
192
|
-
### Release Process
|
|
193
|
-
|
|
194
|
-
1. Build new version: `npm run build:cdn`
|
|
195
|
-
2. Upload new version directory (e.g., `v2.1.1/`)
|
|
196
|
-
3. Update major version directory (`v2/`) with new content
|
|
197
|
-
4. Update `latest/` directory with new content
|
|
198
|
-
5. Invalidate CDN cache for `latest/` and major version
|
|
199
|
-
6. Update `manifest.json` with new SRI hashes
|
|
@@ -1,203 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://developers.cloudflare.com/api/",
|
|
3
|
-
"_comment": "Cloudflare Configuration for Ihooman Chat Widget CDN",
|
|
4
|
-
"zone": {
|
|
5
|
-
"name": "ihooman.ai",
|
|
6
|
-
"settings": {
|
|
7
|
-
"ssl": "full_strict",
|
|
8
|
-
"min_tls_version": "1.2",
|
|
9
|
-
"http3": "on",
|
|
10
|
-
"brotli": "on",
|
|
11
|
-
"minify": {
|
|
12
|
-
"js": false,
|
|
13
|
-
"css": false,
|
|
14
|
-
"html": false
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"dns_records": [
|
|
19
|
-
{
|
|
20
|
-
"type": "CNAME",
|
|
21
|
-
"name": "cdn",
|
|
22
|
-
"content": "cdn-ihooman-widget.r2.cloudflarestorage.com",
|
|
23
|
-
"proxied": true,
|
|
24
|
-
"comment": "CDN subdomain for widget distribution"
|
|
25
|
-
}
|
|
26
|
-
],
|
|
27
|
-
"page_rules": [
|
|
28
|
-
{
|
|
29
|
-
"_comment": "Versioned URLs - Long cache with immutable",
|
|
30
|
-
"targets": [
|
|
31
|
-
{
|
|
32
|
-
"target": "url",
|
|
33
|
-
"constraint": {
|
|
34
|
-
"operator": "matches",
|
|
35
|
-
"value": "cdn.ihooman.ai/widget/v*"
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
],
|
|
39
|
-
"actions": [
|
|
40
|
-
{
|
|
41
|
-
"id": "cache_level",
|
|
42
|
-
"value": "cache_everything"
|
|
43
|
-
},
|
|
44
|
-
{
|
|
45
|
-
"id": "edge_cache_ttl",
|
|
46
|
-
"value": 31536000
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
"id": "browser_cache_ttl",
|
|
50
|
-
"value": 31536000
|
|
51
|
-
}
|
|
52
|
-
],
|
|
53
|
-
"priority": 1,
|
|
54
|
-
"status": "active"
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
"_comment": "Latest URL - Short cache",
|
|
58
|
-
"targets": [
|
|
59
|
-
{
|
|
60
|
-
"target": "url",
|
|
61
|
-
"constraint": {
|
|
62
|
-
"operator": "matches",
|
|
63
|
-
"value": "cdn.ihooman.ai/widget/latest/*"
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
],
|
|
67
|
-
"actions": [
|
|
68
|
-
{
|
|
69
|
-
"id": "cache_level",
|
|
70
|
-
"value": "cache_everything"
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
"id": "edge_cache_ttl",
|
|
74
|
-
"value": 300
|
|
75
|
-
},
|
|
76
|
-
{
|
|
77
|
-
"id": "browser_cache_ttl",
|
|
78
|
-
"value": 300
|
|
79
|
-
}
|
|
80
|
-
],
|
|
81
|
-
"priority": 2,
|
|
82
|
-
"status": "active"
|
|
83
|
-
}
|
|
84
|
-
],
|
|
85
|
-
"cache_rules": [
|
|
86
|
-
{
|
|
87
|
-
"name": "Widget Versioned Cache",
|
|
88
|
-
"description": "Cache versioned widget files for 1 year",
|
|
89
|
-
"expression": "(http.host eq \"cdn.ihooman.ai\" and starts_with(http.request.uri.path, \"/widget/v\"))",
|
|
90
|
-
"action": "set_cache_settings",
|
|
91
|
-
"action_parameters": {
|
|
92
|
-
"cache": true,
|
|
93
|
-
"edge_ttl": {
|
|
94
|
-
"mode": "override_origin",
|
|
95
|
-
"default": 31536000
|
|
96
|
-
},
|
|
97
|
-
"browser_ttl": {
|
|
98
|
-
"mode": "override_origin",
|
|
99
|
-
"default": 31536000
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
{
|
|
104
|
-
"name": "Widget Latest Cache",
|
|
105
|
-
"description": "Cache latest widget files for 5 minutes",
|
|
106
|
-
"expression": "(http.host eq \"cdn.ihooman.ai\" and starts_with(http.request.uri.path, \"/widget/latest/\"))",
|
|
107
|
-
"action": "set_cache_settings",
|
|
108
|
-
"action_parameters": {
|
|
109
|
-
"cache": true,
|
|
110
|
-
"edge_ttl": {
|
|
111
|
-
"mode": "override_origin",
|
|
112
|
-
"default": 300
|
|
113
|
-
},
|
|
114
|
-
"browser_ttl": {
|
|
115
|
-
"mode": "override_origin",
|
|
116
|
-
"default": 300
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
],
|
|
121
|
-
"transform_rules": {
|
|
122
|
-
"response_headers": [
|
|
123
|
-
{
|
|
124
|
-
"name": "Widget CORS Headers",
|
|
125
|
-
"description": "Add CORS headers for widget requests",
|
|
126
|
-
"expression": "(http.host eq \"cdn.ihooman.ai\" and starts_with(http.request.uri.path, \"/widget/\"))",
|
|
127
|
-
"action": "set",
|
|
128
|
-
"action_parameters": {
|
|
129
|
-
"headers": [
|
|
130
|
-
{
|
|
131
|
-
"name": "Access-Control-Allow-Origin",
|
|
132
|
-
"value": "*"
|
|
133
|
-
},
|
|
134
|
-
{
|
|
135
|
-
"name": "Access-Control-Allow-Methods",
|
|
136
|
-
"value": "GET, HEAD, OPTIONS"
|
|
137
|
-
},
|
|
138
|
-
{
|
|
139
|
-
"name": "Access-Control-Allow-Headers",
|
|
140
|
-
"value": "Content-Type, Accept, Origin"
|
|
141
|
-
},
|
|
142
|
-
{
|
|
143
|
-
"name": "Access-Control-Max-Age",
|
|
144
|
-
"value": "86400"
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
"name": "X-Content-Type-Options",
|
|
148
|
-
"value": "nosniff"
|
|
149
|
-
},
|
|
150
|
-
{
|
|
151
|
-
"name": "X-Frame-Options",
|
|
152
|
-
"value": "DENY"
|
|
153
|
-
},
|
|
154
|
-
{
|
|
155
|
-
"name": "Referrer-Policy",
|
|
156
|
-
"value": "strict-origin-when-cross-origin"
|
|
157
|
-
}
|
|
158
|
-
]
|
|
159
|
-
}
|
|
160
|
-
},
|
|
161
|
-
{
|
|
162
|
-
"name": "Widget Versioned Cache Headers",
|
|
163
|
-
"description": "Add immutable cache header for versioned files",
|
|
164
|
-
"expression": "(http.host eq \"cdn.ihooman.ai\" and starts_with(http.request.uri.path, \"/widget/v\") and not starts_with(http.request.uri.path, \"/widget/latest/\"))",
|
|
165
|
-
"action": "set",
|
|
166
|
-
"action_parameters": {
|
|
167
|
-
"headers": [
|
|
168
|
-
{
|
|
169
|
-
"name": "Cache-Control",
|
|
170
|
-
"value": "public, max-age=31536000, immutable"
|
|
171
|
-
}
|
|
172
|
-
]
|
|
173
|
-
}
|
|
174
|
-
},
|
|
175
|
-
{
|
|
176
|
-
"name": "Widget Latest Cache Headers",
|
|
177
|
-
"description": "Add short cache header for latest files",
|
|
178
|
-
"expression": "(http.host eq \"cdn.ihooman.ai\" and starts_with(http.request.uri.path, \"/widget/latest/\"))",
|
|
179
|
-
"action": "set",
|
|
180
|
-
"action_parameters": {
|
|
181
|
-
"headers": [
|
|
182
|
-
{
|
|
183
|
-
"name": "Cache-Control",
|
|
184
|
-
"value": "public, max-age=300"
|
|
185
|
-
}
|
|
186
|
-
]
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
]
|
|
190
|
-
},
|
|
191
|
-
"r2_bucket": {
|
|
192
|
-
"name": "cdn-ihooman-widget",
|
|
193
|
-
"location": "auto",
|
|
194
|
-
"cors_rules": [
|
|
195
|
-
{
|
|
196
|
-
"allowed_origins": ["*"],
|
|
197
|
-
"allowed_methods": ["GET", "HEAD"],
|
|
198
|
-
"allowed_headers": ["*"],
|
|
199
|
-
"max_age_seconds": 86400
|
|
200
|
-
}
|
|
201
|
-
]
|
|
202
|
-
}
|
|
203
|
-
}
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-cloudfront-distribution.html",
|
|
3
|
-
"_comment": "AWS CloudFront Distribution Configuration for Ihooman Chat Widget CDN",
|
|
4
|
-
"Distribution": {
|
|
5
|
-
"DistributionConfig": {
|
|
6
|
-
"Comment": "Ihooman Chat Widget CDN - cdn.ihooman.ai",
|
|
7
|
-
"Enabled": true,
|
|
8
|
-
"HttpVersion": "http2and3",
|
|
9
|
-
"IPV6Enabled": true,
|
|
10
|
-
"PriceClass": "PriceClass_All",
|
|
11
|
-
"DefaultRootObject": "",
|
|
12
|
-
"Aliases": {
|
|
13
|
-
"Items": ["cdn.ihooman.ai"]
|
|
14
|
-
},
|
|
15
|
-
"Origins": {
|
|
16
|
-
"Items": [
|
|
17
|
-
{
|
|
18
|
-
"Id": "S3-widget-origin",
|
|
19
|
-
"DomainName": "cdn-ihooman-widget.s3.amazonaws.com",
|
|
20
|
-
"S3OriginConfig": {
|
|
21
|
-
"OriginAccessIdentity": "origin-access-identity/cloudfront/EXAMPLE"
|
|
22
|
-
},
|
|
23
|
-
"OriginPath": "/widget"
|
|
24
|
-
}
|
|
25
|
-
]
|
|
26
|
-
},
|
|
27
|
-
"DefaultCacheBehavior": {
|
|
28
|
-
"TargetOriginId": "S3-widget-origin",
|
|
29
|
-
"ViewerProtocolPolicy": "redirect-to-https",
|
|
30
|
-
"AllowedMethods": ["GET", "HEAD", "OPTIONS"],
|
|
31
|
-
"CachedMethods": ["GET", "HEAD"],
|
|
32
|
-
"Compress": true,
|
|
33
|
-
"CachePolicyId": "VERSIONED_CACHE_POLICY_ID",
|
|
34
|
-
"ResponseHeadersPolicyId": "CORS_SECURITY_HEADERS_POLICY_ID"
|
|
35
|
-
},
|
|
36
|
-
"CacheBehaviors": {
|
|
37
|
-
"Items": [
|
|
38
|
-
{
|
|
39
|
-
"_comment": "Latest version - short cache",
|
|
40
|
-
"PathPattern": "/latest/*",
|
|
41
|
-
"TargetOriginId": "S3-widget-origin",
|
|
42
|
-
"ViewerProtocolPolicy": "redirect-to-https",
|
|
43
|
-
"AllowedMethods": ["GET", "HEAD", "OPTIONS"],
|
|
44
|
-
"CachedMethods": ["GET", "HEAD"],
|
|
45
|
-
"Compress": true,
|
|
46
|
-
"CachePolicyId": "LATEST_CACHE_POLICY_ID",
|
|
47
|
-
"ResponseHeadersPolicyId": "CORS_SECURITY_HEADERS_POLICY_ID"
|
|
48
|
-
}
|
|
49
|
-
]
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
"CachePolicies": {
|
|
54
|
-
"VersionedCachePolicy": {
|
|
55
|
-
"_comment": "Cache policy for versioned URLs (v2/, v2.1.0/)",
|
|
56
|
-
"CachePolicyConfig": {
|
|
57
|
-
"Name": "IhoomanWidget-Versioned-CachePolicy",
|
|
58
|
-
"Comment": "1 year cache for immutable versioned widget files",
|
|
59
|
-
"DefaultTTL": 31536000,
|
|
60
|
-
"MaxTTL": 31536000,
|
|
61
|
-
"MinTTL": 31536000,
|
|
62
|
-
"ParametersInCacheKeyAndForwardedToOrigin": {
|
|
63
|
-
"EnableAcceptEncodingGzip": true,
|
|
64
|
-
"EnableAcceptEncodingBrotli": true,
|
|
65
|
-
"HeadersConfig": {
|
|
66
|
-
"HeaderBehavior": "none"
|
|
67
|
-
},
|
|
68
|
-
"CookiesConfig": {
|
|
69
|
-
"CookieBehavior": "none"
|
|
70
|
-
},
|
|
71
|
-
"QueryStringsConfig": {
|
|
72
|
-
"QueryStringBehavior": "none"
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
"LatestCachePolicy": {
|
|
78
|
-
"_comment": "Cache policy for latest URL",
|
|
79
|
-
"CachePolicyConfig": {
|
|
80
|
-
"Name": "IhoomanWidget-Latest-CachePolicy",
|
|
81
|
-
"Comment": "5 minute cache for latest widget files",
|
|
82
|
-
"DefaultTTL": 300,
|
|
83
|
-
"MaxTTL": 300,
|
|
84
|
-
"MinTTL": 300,
|
|
85
|
-
"ParametersInCacheKeyAndForwardedToOrigin": {
|
|
86
|
-
"EnableAcceptEncodingGzip": true,
|
|
87
|
-
"EnableAcceptEncodingBrotli": true,
|
|
88
|
-
"HeadersConfig": {
|
|
89
|
-
"HeaderBehavior": "none"
|
|
90
|
-
},
|
|
91
|
-
"CookiesConfig": {
|
|
92
|
-
"CookieBehavior": "none"
|
|
93
|
-
},
|
|
94
|
-
"QueryStringsConfig": {
|
|
95
|
-
"QueryStringBehavior": "none"
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
},
|
|
101
|
-
"ResponseHeadersPolicies": {
|
|
102
|
-
"CORSAndSecurityHeaders": {
|
|
103
|
-
"_comment": "Response headers policy for CORS and security",
|
|
104
|
-
"ResponseHeadersPolicyConfig": {
|
|
105
|
-
"Name": "IhoomanWidget-CORS-Security-Headers",
|
|
106
|
-
"Comment": "CORS and security headers for widget CDN",
|
|
107
|
-
"CorsConfig": {
|
|
108
|
-
"AccessControlAllowCredentials": false,
|
|
109
|
-
"AccessControlAllowHeaders": {
|
|
110
|
-
"Items": ["Content-Type", "Accept", "Origin"]
|
|
111
|
-
},
|
|
112
|
-
"AccessControlAllowMethods": {
|
|
113
|
-
"Items": ["GET", "HEAD", "OPTIONS"]
|
|
114
|
-
},
|
|
115
|
-
"AccessControlAllowOrigins": {
|
|
116
|
-
"Items": ["*"]
|
|
117
|
-
},
|
|
118
|
-
"AccessControlMaxAgeSec": 86400,
|
|
119
|
-
"OriginOverride": true
|
|
120
|
-
},
|
|
121
|
-
"SecurityHeadersConfig": {
|
|
122
|
-
"ContentTypeOptions": {
|
|
123
|
-
"Override": true
|
|
124
|
-
},
|
|
125
|
-
"FrameOptions": {
|
|
126
|
-
"FrameOption": "DENY",
|
|
127
|
-
"Override": true
|
|
128
|
-
},
|
|
129
|
-
"ReferrerPolicy": {
|
|
130
|
-
"ReferrerPolicy": "strict-origin-when-cross-origin",
|
|
131
|
-
"Override": true
|
|
132
|
-
},
|
|
133
|
-
"StrictTransportSecurity": {
|
|
134
|
-
"AccessControlMaxAgeSec": 31536000,
|
|
135
|
-
"IncludeSubdomains": true,
|
|
136
|
-
"Preload": true,
|
|
137
|
-
"Override": true
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
"CustomHeadersConfig": {
|
|
141
|
-
"Items": [
|
|
142
|
-
{
|
|
143
|
-
"_comment": "Versioned files get immutable cache header",
|
|
144
|
-
"Header": "Cache-Control",
|
|
145
|
-
"Value": "public, max-age=31536000, immutable",
|
|
146
|
-
"Override": false
|
|
147
|
-
}
|
|
148
|
-
]
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
}
|