mirror of
https://github.com/discourse/discourse.git
synced 2025-05-31 03:18:09 +08:00
DEV: remove legacy CSP implementation to make strict-dynamic only accepted behaviour (#27486)
* DEV: remove legacy CSP implementation that allowed for non-strict-dynamic behaviour
This commit is contained in:
@ -173,21 +173,6 @@ async function handleRequest(proxy, baseURL, req, res, outputPath) {
|
||||
res.set("location", newLocation);
|
||||
}
|
||||
|
||||
const csp = response.headers.get("content-security-policy");
|
||||
if (csp && !csp.includes("'strict-dynamic'")) {
|
||||
const emberCliAdditions = [
|
||||
`http://${originalHost}${baseURL}assets/`,
|
||||
`http://${originalHost}${baseURL}ember-cli-live-reload.js`,
|
||||
`http://${originalHost}${baseURL}_lr/`,
|
||||
].join(" ");
|
||||
|
||||
const newCSP = csp
|
||||
.replaceAll(proxy, `http://${originalHost}`)
|
||||
.replaceAll("script-src ", `script-src ${emberCliAdditions} `);
|
||||
|
||||
res.set("content-security-policy", newCSP);
|
||||
}
|
||||
|
||||
const contentType = response.headers.get("content-type");
|
||||
const isHTML = contentType?.startsWith("text/html");
|
||||
|
||||
|
Reference in New Issue
Block a user