Skip to content

Commit

Permalink
fix: apply suggested changes
Browse files Browse the repository at this point in the history
Co-authored-by: Asher Gomez <[email protected]>
  • Loading branch information
Jabolol and iuioiua authored Sep 17, 2023
1 parent 6f15b08 commit 7dfdf4a
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions middleware/headers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,11 @@ export async function hardenHeaders(
req: Request,
ctx: MiddlewareHandlerContext,
) {
if (
ctx.destination !== "route" || new URL(req.url).pathname.startsWith("/api")
) return await ctx.next();

const response = await ctx.next();
const path = new URL(req.url).pathname.split("/")[1] || "/";
const blacklist = [/api/];

if (blacklist.some((regex) => regex.test(path))) {
return response;
}

const contentSecurityPolicy = [
"default-src 'self'",
Expand Down

0 comments on commit 7dfdf4a

Please sign in to comment.