Skip to content

Commit

Permalink
fix(routes/docs): limit files served from redoc module
Browse files Browse the repository at this point in the history
  • Loading branch information
Fdawgs committed Jan 4, 2023
1 parent bc7ef68 commit 0463d2f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/routes/docs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ async function route(server) {
// Allow for static files to be served from this dir via `sendFile`
.register(staticPlugin, { root: __dirname, serve: false })

// Register redoc module to allow for js to be used in docs.html
// Register redoc module to allow for standalone js and map to be used in docs.html
.register(staticPlugin, {
root: path.joinSafe(
__dirname,
Expand All @@ -29,9 +29,11 @@ async function route(server) {
"redoc",
"bundles"
),
prefix: "/redoc/",
allowedPath: (pathName) =>
pathName.match(/\/redoc\.standalone\.js(?:.map|)/),
decorateReply: false,
maxAge: "1 day",
prefix: "/redoc/",
});

server.route({
Expand Down

0 comments on commit 0463d2f

Please sign in to comment.