generated from shgysk8zer0/npm-template
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhttp.config.js
More file actions
25 lines (22 loc) · 805 Bytes
/
http.config.js
File metadata and controls
25 lines (22 loc) · 805 Bytes
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
import home from '@aegisjsproject/dev-server';
import favicon from '@aegisjsproject/dev-server/favicon';
import { Importmap, imports, scopes } from '@shgysk8zer0/importmap';
const importmap = new Importmap({ imports, scopes });
await importmap.importLocalPackage();
const integrity = await importmap.getIntegrity();
const csp = `default-src 'none'; script-src ${imports['@shgysk8zer0/polyfills']} '${integrity}'; style-src 'self'; img-src 'self'; require-trusted-types-for 'script';`;
export default {
open: true,
routes: {
'/': home,
'/favicon.svg': favicon,
},
responsePostprocessors: [
(response, { request }) => {
if (request.destination === 'document') {
response.headers.set('Content-Type', 'text/html');
response.headers.set('Content-Security-Policy', csp);
}
}
],
};