Skip to content

Commit ab9642c

Browse files
Merge branch 'canary' into patch-2
2 parents 7188a79 + cc57fe8 commit ab9642c

File tree

6 files changed

+30
-18
lines changed

6 files changed

+30
-18
lines changed

docs/02-app/01-building-your-application/05-styling/03-css-in-js.mdx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ The following libraries are supported in Client Components in the `app` director
1616
- [`chakra-ui`](https://chakra-ui.com/getting-started/nextjs-app-guide)
1717
- [`kuma-ui`](https://kuma-ui.com)
1818
- [`@mui/material`](https://mui.com/material-ui/guides/next-js-app-router/)
19+
- [`@mui/joy`](https://mui.com/joy-ui/integrations/next-js-app-router/)
1920
- [`pandacss`](https://panda-css.com)
2021
- [`styled-jsx`](#styled-jsx)
2122
- [`styled-components`](#styled-components)

docs/02-app/01-building-your-application/09-authentication/index.mdx

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -332,15 +332,22 @@ Once a user is authenticated, you'll need to ensure the user is allowed to visit
332332

333333
Here's how to implement Middleware for authentication in Next.js:
334334

335-
1. **Setting Up Middleware:**
336-
- Create a `middleware.ts` or `.js` file in your project's root directory.
337-
- Include logic to authorize user access, such as checking for authentication tokens.
338-
2. **Defining Protected Routes:**
339-
- Not all routes require authorization. Use the `matcher` option in your Middleware to specify any routes that do not require authorization checks.
340-
3. **Middleware Logic:**
341-
- Write logic to verify if a user is authenticated. Check user roles or permissions for route authorization.
342-
4. **Handling Unauthorized Access:**
343-
- Redirect unauthorized users to a login or error page as appropriate.
335+
#### Setting Up Middleware:
336+
337+
- Create a `middleware.ts` or `.js` file in your project's root directory.
338+
- Include logic to authorize user access, such as checking for authentication tokens.
339+
340+
#### Defining Protected Routes:
341+
342+
- Not all routes require authorization. Use the `matcher` option in your Middleware to specify any routes that do not require authorization checks.
343+
344+
#### Middleware Logic:
345+
346+
- Write logic to verify if a user is authenticated. Check user roles or permissions for route authorization.
347+
348+
#### Handling Unauthorized Access:
349+
350+
- Redirect unauthorized users to a login or error page as appropriate.
344351

345352
Example Middleware file:
346353

examples/with-docker/Dockerfile

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ WORKDIR /app
2222
COPY --from=deps /app/node_modules ./node_modules
2323
COPY . .
2424

25+
RUN mkdir -p public
26+
2527
# Next.js collects completely anonymous telemetry data about general usage.
2628
# Learn more here: https://nextjs.org/telemetry
2729
# Uncomment the following line in case you want to disable telemetry during the build.
@@ -45,17 +47,17 @@ ENV NODE_ENV production
4547
RUN addgroup --system --gid 1001 nodejs
4648
RUN adduser --system --uid 1001 nextjs
4749

48-
COPY --from=builder /app/public ./public
49-
50-
# Set the correct permission for prerender cache
51-
RUN mkdir .next
52-
RUN chown nextjs:nodejs .next
53-
5450
# Automatically leverage output traces to reduce image size
5551
# https://nextjs.org/docs/advanced-features/output-file-tracing
52+
COPY --from=builder --chown=nextjs:nodejs /app/public ./public
5653
COPY --from=builder --chown=nextjs:nodejs /app/.next/standalone ./
5754
COPY --from=builder --chown=nextjs:nodejs /app/.next/static ./.next/static
5855

56+
# Set the correct permission for prerender cache
57+
RUN mkdir -p .next/cache
58+
RUN chown -R nextjs:nodejs .next
59+
RUN chmod -R 777 .next/cache
60+
5961
USER nextjs
6062

6163
EXPOSE 3000

examples/with-strict-csp/middleware.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@ export function middleware(request) {
44
const nonce = Buffer.from(crypto.randomUUID()).toString("base64");
55
const cspHeader = `
66
default-src 'self';
7-
script-src 'self' 'nonce-${nonce}' 'strict-dynamic';
7+
script-src 'self' 'nonce-${nonce}' 'strict-dynamic' https: http: 'unsafe-inline' ${
8+
process.env.NODE_ENV === "production" ? "" : `'unsafe-eval'`
9+
};
810
style-src 'self' 'nonce-${nonce}';
911
img-src 'self' blob: data:;
1012
font-src 'self';

packages/next/src/server/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ function assignDefaults(
559559
)
560560
if (isNaN(value) || value < 1) {
561561
throw new Error(
562-
'Server Actions Size Limit must be a valid number or filesize format lager than 1MB: https://nextjs.org/docs/app/api-reference/functions/server-actions#size-limitation'
562+
'Server Actions Size Limit must be a valid number or filesize format larger than 1MB: https://nextjs.org/docs/app/api-reference/functions/server-actions#size-limitation'
563563
)
564564
}
565565
}

test/e2e/app-dir/actions/app-action-size-limit-invalid.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { createNextDescribe } from 'e2e-utils'
22
import { check } from 'next-test-utils'
33

44
const CONFIG_ERROR =
5-
'Server Actions Size Limit must be a valid number or filesize format lager than 1MB'
5+
'Server Actions Size Limit must be a valid number or filesize format larger than 1MB'
66

77
createNextDescribe(
88
'app-dir action size limit invalid config',

0 commit comments

Comments
 (0)