Skip to content

Commit

Permalink
serve text/html with utf8 charset, restore · (#403)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamschwartz committed Jun 5, 2020
1 parent 4260ecf commit 681ce7b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>Is BGP safe yet? - Cloudflare</title>
<title>Is BGP safe yet? · Cloudflare</title>

<meta name="description" content="On the Internet, network devices exchange routes via a protocol called BGP (Border Gateway Protocol). Unfortunately, issues with BGP have led to malicious actors being able to hijack and misconfigure devices leading to security problems which have the potential to cause widespread problems. BGP security can be greatly improved by using technologies such as RPKI to sign Internet routes. This page attempts to track the progress of major Internet players (ISPs, transit operators, and content providers) in their progress to adopt RPKI and other technologies.">
<meta name="keywords" content="BGP, RPKI, Cloudflare">
Expand Down
7 changes: 7 additions & 0 deletions workers-site/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,13 @@ async function handleEvent(event) {
// Allow headers to be altered
const response = new Response(page.body, page)

// // Manually adding utf8 charset for now since kv-asset-handler
// has it fixed (https://git.io/Jf1aQ) but it's not yet in a release
const contentType = response.headers.get('content-type')
if (contentType.startsWith('text')) {
response.headers.set('content-type', contentType + '; charset=utf8')
}

if (url.pathname === '/' || url.pathname === '/index.html') {
response.headers.set('Cache-Control', 'public; max-age=60')
response.headers.set('Content-Security-Policy', "default-src 'none'; script-src 'self' data: 'unsafe-inline'; object-src 'none'; style-src 'self' ui.components.workers.dev; img-src 'self'; media-src 'none'; frame-src 'none'; font-src 'none'; connect-src 'self' invalid.rpki.cloudflare.com valid.rpki.cloudflare.com")
Expand Down

0 comments on commit 681ce7b

Please sign in to comment.