fix: Restore DNS prefetching for static resources (#1820)

* fix: Restore DNS prefetching for static resources

* fix: CDN paths
feat: preload instead of prefetch for key bundles

* csp

* fix: Turns out prefetch-src is still behind a flag in Chrome, not publicly available yet
This commit is contained in:
Tom Moor
2021-01-18 15:48:46 -08:00
committed by GitHub
parent 27fca28450
commit 3bace8c9e4
7 changed files with 76 additions and 53 deletions

View File

@ -10,6 +10,7 @@ import { languages } from "../shared/i18n";
import environment from "./env";
import apexRedirect from "./middlewares/apexRedirect";
import { opensearchResponse } from "./utils/opensearch";
import prefetchTags from "./utils/prefetchTags";
import { robotsResponse } from "./utils/robots";
const isProduction = process.env.NODE_ENV === "production";
@ -50,6 +51,7 @@ const renderApp = async (ctx, next) => {
ctx.body = page
.toString()
.replace(/\/\/inject-env\/\//g, env)
.replace(/\/\/inject-prefetch\/\//g, prefetchTags)
.replace(/\/\/inject-sentry-dsn\/\//g, process.env.SENTRY_DSN || "")
.replace(/\/\/inject-slack-app-id\/\//g, process.env.SLACK_APP_ID || "");
};