forked from lodash/lodash.com
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_headers
226 lines (206 loc) · 5.52 KB
/
_headers
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
---
csp:
default-src: [
"'none'"
]
child-src: [
"'self'",
'data:',
'ms-appx-web:',
'ghbtns.com',
'runkit.com',
'*.runkit-embed.com',
'runkit-embed.com',
'platform.twitter.com'
]
connect-src: [
'lodash.report-uri.com',
'lodash.report-uri.io'
]
img-src: [
"'self'",
'data:',
'*.2mdn.net',
'*.adsafeprotected.com',
'ad.atdmt.com',
'*.buysellads.com',
'*.buysellads.net',
'*.c3tag.com',
'*.convertro.com',
'ad.doubleclick.net',
'www.google-analytics.com',
'www.launchbit.com',
'launchbit.com',
'assets.servedby-buysellads.com',
'*.serving-sys.com'
]
font-src: [
"'self'",
'data:',
'fonts.gstatic.com',
'cdn.jsdelivr.net'
]
frame-src: [
"'self'",
'data:',
'ms-appx-web:',
'ghbtns.com',
'runkit.com',
'*.runkit-embed.com',
'runkit-embed.com',
'platform.twitter.com'
]
manifest-src: [
"'self'"
]
script-src: [
"'self'",
'*.carbonads.com',
'srv.carbonads.net',
'adn.fusionads.net',
'www.google-analytics.com',
'cdn.jsdelivr.net',
'embed.runkit.com'
]
style-src: [
"'self'",
'cdn.jsdelivr.net'
]
hints:
all: [
'</sw.js>; rel=serviceworker',
'<https://cdn.jsdelivr.net/>; rel=preconnect; pr=1.0; crossorigin',
'<//runkit.com/>; rel=dns-prefetch; pr=0.25; crossorigin',
'<//cdn.carbonads.com/>; rel=dns-prefetch; pr=0.25',
'<//srv.carbonads.net/>; rel=dns-prefetch; pr=0.25'
]
home: [
'<//ghbtns.com/>; rel=dns-prefetch; pr=1.0; crossorigin',
'<//platform.twitter.com/>; rel=dns-prefetch; pr=1.0; crossorigin'
]
---
{% capture EOL %}
{% endcapture %}
{% assign all = page.hints.all %}
{% assign docs = site.data.init.array %}
{% assign home = page.hints.home %}
{% comment %}
Add resource hints for site-wide css.
{% endcomment %}
{% for href in site.css.all %}
{% capture hint %}<{{ href }}>; rel=preload; as=style; pr=1.0{% endcapture %}
{% assign all = all | push:hint %}
{% endfor %}
{% comment %}
Add resource hints for site-wide vendor css.
{% endcomment %}
{% for res in site.vendor.css %}
{% capture hint %}<{{ res.href }}>; rel=preload; as=style; pr=1.0; crossorigin{% endcapture %}
{% assign all = all | push:hint %}
{% endfor %}
{% comment %}
Add resource hints for site-wide font faces.
{% endcomment %}
{% for family in site.font-face %}
{% for style in family[1] %}
{% for href in style[1] %}
{% if href contains '.woff2' %}
{% capture hint %}<{{ href }}>; rel=preload; as=font; pr=1.0; crossorigin{% endcapture %}
{% assign all = all | push:hint %}
{% endif %}
{% endfor %}
{% endfor %}
{% endfor %}
{% comment %}
Add resource hints for site-wide js.
{% endcomment %}
{% for href in site.js.all %}
{% capture hint %}<{{ href }}>; rel=preload; as=script; pr=1.0{% endcapture %}
{% assign all = all | push:hint %}
{% endfor %}
{% comment %}
Add site-wide hints to docs and homepage hints.
{% endcomment %}
{% for hint in all %}
{% assign docs = docs | push:hint %}
{% assign home = home | push:hint %}
{% endfor %}
{% comment %}
Add resource hints for home js.
{% endcomment %}
{% for href in site.js.home %}
{% capture hint %}<{{ href }}>; rel=preload; as=script; pr=1.0{% endcapture %}
{% assign home = home | push:hint %}
{% endfor %}
{% comment %}
Add resource hints for docs js.
{% endcomment %}
{% for href in site.js.docs %}
{% capture hint %}<{{ href }}>; rel=preload; as=script; pr=1.0{% endcapture %}
{% assign docs = docs | push:hint %}
{% endfor %}
{% comment %}
Add resource hints for docs vendor js.
{% endcomment %}
{% for res in site.vendor.js %}
{% capture hint %}<{{ res.href }}>; rel=preload; as=script; pr=1.0; crossorigin{% endcapture %}
{% assign docs = docs | push:hint %}
{% endfor %}
{% comment %}
Add link headers for non-doc pages.
{% endcomment %}
{% for page in site.html_pages %}
{% assign parts = page.url | split:'/' %}
{% if parts.size == 2 %}
{{ page.url | replace_first:'.html','*' }}
Link: {{ all | join:', ' }}
{% endif %}
{% endfor %}
{% comment %}
Add link headers for the homepage.
{% endcomment %}
/
Link: {{ home | join:', ' }}
/index*
Link: {{ home | join:', ' }}
{% comment %}
Add link header for doc pages.
{% endcomment %}
/docs/*
Link: {{ docs | join:', ' }}
{% for res in site.builds %}
/docs/{{ res[0] }}*
Link: <{{ res[1].href }}>; rel=preload; as=script; pr=1.0; crossorigin
{% endfor %}
{% comment %}
Add CSP header directives.
{% endcomment %}
{% assign connect-src = page.csp.connect-src %}
{% for entry in page.csp %}
{% unless entry[0] == 'connect-src' %}
{% capture directive %}{{ entry[0] }} {{ entry[1] | join:' ' }}; {% endcapture %}
{% assign csp = csp | append:directive %}
{% for src in entry[1] %}
{% unless src == 'data:' or src == "'none'" %}
{% assign connect-src = connect-src | push:src %}
{% endunless %}
{% endfor %}
{% endunless %}
{% endfor %}
{% capture connect-src %}connect-src {{ connect-src | uniq | join:' ' }}; {% endcapture %}
{% assign csp = csp | append:connect-src %}
/*
Access-Control-Allow-Origin: https://lodash.com
Referrer-Policy: origin-when-cross-origin
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
Content-Security-Policy: {{ "
block-all-mixed-content;
report-uri https://lodash.report-uri.io/r/default/csp/enforce;
" | replace:EOL,' ' | append:csp }}
/*.appcache
Cache-Control: no-cache
Content-Type: text/cache-manifest
/*.webmanifest
Content-Type: application/manifest+json