1.0.0-beta.8 • Published 5 months ago

@nosecone/next v1.0.0-beta.8

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
5 months ago

@nosecone/next

Protect your Next.js application with secure headers.

Installation

npm install -S @nosecone/next

Example

Create a middleware.ts file with the contents:

import { createMiddleware } from "@nosecone/next";

export const config = {
  // matcher tells Next.js to run middleware on all routes
  matcher: ["/(.*)"],
};

export default createMiddleware();

Add await connection() in your app/layout.tsx file:

+ import { connection } from "next/server";

export default async function RootLayout({
  children,
}: {
  children: React.ReactNode;
}) {
+  // Opt-out of static generation for every page so the CSP nonce can be applied
+  await connection()

  return (
    <html lang="en">
      <body className={inter.className}>{children}</body>
    </html>
  );
}

License

Licensed under the Apache License, Version 2.0.

1.0.0-beta.8

5 months ago

1.0.0-beta.7

6 months ago

1.0.0-beta.6

7 months ago

1.0.0-beta.5

8 months ago

1.0.0-beta.4

8 months ago

1.0.0-beta.3

8 months ago

1.0.0-beta.2

9 months ago

1.0.0-beta.1

10 months ago

1.0.0-alpha.34

11 months ago

1.0.0-alpha.33

11 months ago

1.0.0-alpha.32

12 months ago

1.0.0-alpha.31

12 months ago

1.0.0-alpha.30

12 months ago

1.0.0-alpha.29

12 months ago