Skip to content

Commit

Permalink
try to fix csp import
Browse files Browse the repository at this point in the history
  • Loading branch information
RickCogley committed Nov 9, 2024
1 parent ab33ccd commit 9e2c392
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import precompress from "lume/middlewares/precompress.ts";
import expires from "lume/middlewares/expires.ts";
// import csp from "https://raw.githubusercontent.com/lumeland/experimental-plugins/main/csp/mod.ts";

import csp from "https://raw.githubusercontent.com/RickCogley/experimental-plugins/refs/heads/main/csp/mod.ts"

const server = new Server({
port: 8000,
root: `${Deno.cwd()}/_site`,
Expand Down Expand Up @@ -33,20 +35,20 @@ function isProtected(req) {
// assumes you are precompressing, say with the brotli plugin
server.use(precompress());
server.use(expires());
// pass your preferred security header options:
// server.use(csp({
// "Strict-Transport-Security": {
// maxAge: DEFAULT_MAX_AGE,
// includeSubDomains: true,
// preload: true,
// },
// "Referrer-Policy": ["no-referrer", "strict-origin-when-cross-origin"],
// "X-Frame-Options": true,
// "X-Content-Type-Options": true,
// "X-XSS-Protection": true,
// "X-Permitted-Cross-Domain-Policies": true,
// "X-Powered-By": true,
// }));
pass your preferred security header options:
server.use(csp({
"Strict-Transport-Security": {
maxAge: DEFAULT_MAX_AGE,
includeSubDomains: true,
preload: true,
},
"Referrer-Policy": ["no-referrer", "strict-origin-when-cross-origin"],
"X-Frame-Options": true,
"X-Content-Type-Options": true,
"X-XSS-Protection": true,
"X-Permitted-Cross-Domain-Policies": true,
"X-Powered-By": true,
}));

server.use(async (request, next) => {
const response = await next(request);
Expand Down

1 comment on commit 9e2c392

@deno-deploy
Copy link
Contributor

@deno-deploy deno-deploy bot commented on 9e2c392 Nov 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Failed to deploy:

The module's source code could not be parsed: Expected ';', '}' or <eof> at file:///src/serve.ts:38:6

  pass your preferred security header options:
       ~~~~

Please sign in to comment.