Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/next/src/lib/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const PRERENDER_REVALIDATE_ONLY_GENERATED_HEADER =

export const RSC_PREFETCH_SUFFIX = '.prefetch.rsc'
export const RSC_SUFFIX = '.rsc'
export const ACTION_SUFFIX = '.action'
export const NEXT_DATA_SUFFIX = '.json'
export const NEXT_META_SUFFIX = '.meta'
export const NEXT_BODY_SUFFIX = '.body'
Expand Down
12 changes: 11 additions & 1 deletion packages/next/src/server/base-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ import getRouteFromAssetPath from '../shared/lib/router/utils/get-route-from-ass
import { stripInternalHeaders } from './internal-utils'
import { RSCPathnameNormalizer } from './future/normalizers/request/rsc'
import { PostponedPathnameNormalizer } from './future/normalizers/request/postponed'
import { ActionPathnameNormalizer } from './future/normalizers/request/action'
import { stripFlightHeaders } from './app-render/strip-flight-headers'
import {
isAppPageRouteModule,
Expand Down Expand Up @@ -402,6 +403,7 @@ export default abstract class Server<
protected readonly localeNormalizer?: LocaleRouteNormalizer

protected readonly normalizers: {
readonly action: ActionPathnameNormalizer | undefined
readonly postponed: PostponedPathnameNormalizer | undefined
readonly rsc: RSCPathnameNormalizer | undefined
readonly prefetchRSC: PrefetchRSCPathnameNormalizer | undefined
Expand Down Expand Up @@ -496,6 +498,10 @@ export default abstract class Server<
data: this.enabledDirectories.pages
? new NextDataPathnameNormalizer(this.buildId)
: undefined,
action:
this.enabledDirectories.app && this.minimalMode
? new ActionPathnameNormalizer()
: undefined,
}

this.nextFontManifest = this.getNextFontManifest()
Expand Down Expand Up @@ -974,7 +980,7 @@ export default abstract class Server<

let { pathname: urlPathname } = new URL(req.url, 'http://localhost')

// For ISR the URL is normalized to the prerenderPath so if
// For ISR the URL is normalized to the prerenderPath so if
// it's a data request the URL path will be the data URL,
// basePath is already stripped by this point
if (this.normalizers.data?.match(urlPathname)) {
Expand Down Expand Up @@ -1427,6 +1433,10 @@ export default abstract class Server<
normalizers.push(this.normalizers.rsc)
}

if (this.normalizers.action) {
normalizers.push(this.normalizers.action)
}

for (const normalizer of normalizers) {
if (!normalizer.match(pathname)) continue

Expand Down
13 changes: 13 additions & 0 deletions packages/next/src/server/future/normalizers/request/action.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { PathnameNormalizer } from './pathname-normalizer'

import { ACTION_SUFFIX } from '../../../../lib/constants'
import { SuffixPathnameNormalizer } from './suffix'

export class ActionPathnameNormalizer
extends SuffixPathnameNormalizer
implements PathnameNormalizer
{
constructor() {
super(ACTION_SUFFIX)
}
}