Skip to content

Commit

Permalink
Add workaround for swagger-api/swagger-ui#3370
Browse files Browse the repository at this point in the history
  • Loading branch information
fyang1024 authored and SkeLLLa committed Aug 25, 2020
1 parent 027d965 commit d839d54
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@ async function oasRoutes(fastify, options) {
reply.redirect(`${redirectUrl}index.html`);
},
});
const swaggerCspHeader = "script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' 'unsafe-inline' data: ; object-src 'none'";
fastify.register(fstatic, {
setHeaders: (res, path, stat) => {res.setHeader('Content-Security-Policy', swaggerCspHeader)},
root: path.join(__dirname, '..', 'static'),
});
}
Expand Down

0 comments on commit d839d54

Please sign in to comment.