nextjs - 💡(How to fix) Fix Turbopack chunk filenames containing ~ (tilde) blocked by enterprise WAFs [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
vercel/next.js#92250Fetched 2026-04-08 02:32:43
View on GitHub
Comments
1
Participants
2
Timeline
6
Reactions
0
Timeline (top)
labeled ×2closed ×1commented ×1issue_type_added ×1

Fix Action

Fix / Workaround

Workaround: next build --webpack avoids the issue but opts out of Turbopack performance gains.

Code Example

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Enterprise
  Available memory (MB): 64957
  Available CPU cores: 14
Binaries:
  Node: 24.14.0
  npm: 11.9.0
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 16.2.2
  react: 19.2.4
  react-dom: 19.2.4
Next.js Config:
  output: N/A

Deployment: behind enterprise WAF
Issue reproduced on: 16.2.x (not present in 16.1.5)
RAW_BUFFERClick to expand / collapse

Link to the code that reproduces this issue

https://github.com/donkeyote/next-tests-typecheck

To Reproduce

  1. run pnpm install && pnpm build && pnpm start
  2. Inspect chunks filenames in view-source:localhost:3000 — filenames contain ~ characters
  3. Deploy behind any WAF that flags ~ in URL paths
  4. App fails to load — WAF returns 400 with text/html instead of JS.

Current vs. Expected behavior

Turbopack (16.2.x) generates chunk filenames containing ~ (tilde) characters, e.g. _next/static/chunks/0259pyb~8-2~v.js.

Expected: Chunk filenames use only URL/WAF-safe characters (alphanumeric, -, _, .) Actual: Chunk filenames contain ~ which is flagged by enterprise WAF rules, causing a 400 response with text/html instead of application/javascript. The browser refuses to execute the file and the app breaks entirely.

Previous behavior in 16.1.x (hex hashes) was WAF-compatible: d0b8996cb3d22274.js 96c0a41d0f0dc35b.js

New behavior in 16.2.x (tilde format) is blocked: 0259pyb8~2v.js 09072fu2~0v1.js

Provide environment information

Operating System:
  Platform: win32
  Arch: x64
  Version: Windows 11 Enterprise
  Available memory (MB): 64957
  Available CPU cores: 14
Binaries:
  Node: 24.14.0
  npm: 11.9.0
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 16.2.2
  react: 19.2.4
  react-dom: 19.2.4
Next.js Config:
  output: N/A

Deployment: behind enterprise WAF
Issue reproduced on: 16.2.x (not present in 16.1.5)

Which area(s) are affected? (Select all that apply)

Turbopack

Which stage(s) are affected? (Select all that apply)

next build (local)

Additional context

This is the issue that was posted here https://github.com/vercel/next.js/issues/92250 - I'm another person who experienced it - I just added an example repo with reproduction.

The WAF returns a 400 response with text/html for any request to /_next/static/chunks/*.js filenames containing ~. The browser then refuses to execute the file due to MIME type mismatch, breaking the app entirely.

This is not reproducible on Vercel (no WAF layer), which likely explains why this hasn't been widely reported despite affecting any self-hosted enterprise deployment behind standard WAF rulesets.

The issue is not present in 16.1.x where Turbopack used hex-only chunk filenames. The ~ character appears to have been introduced as part of Turbopack's compressed chunk naming format in 16.2.x.

Workaround: next build --webpack avoids the issue but opts out of Turbopack performance gains.

Requested: a Turbopack config option to restrict chunk filename characters to WAF-safe alphanumerics (similar to webpack's output.chunkFilename).

extent analysis

TL;DR

Use the next build --webpack command as a temporary workaround to avoid the issue with Turbopack's chunk filenames containing ~ characters.

Guidance

  • Identify the specific WAF rules that are flagging the ~ characters in the chunk filenames and consider temporarily disabling or modifying them to allow the app to function.
  • Explore the possibility of using a custom chunk filename format in Turbopack that avoids the use of ~ characters, similar to webpack's output.chunkFilename option.
  • Consider upgrading to a future version of Next.js that may include a fix for this issue, if available.
  • Test the app on a different deployment platform, such as Vercel, to see if the issue is specific to the current OpenShift deployment.

Example

No code snippet is provided as the issue is related to the configuration of Turbopack and the WAF, rather than a specific code problem.

Notes

The issue appears to be specific to the combination of Turbopack in Next.js 16.2.x and the enterprise WAF rules. The workaround using next build --webpack may not be ideal as it opts out of Turbopack's performance gains.

Recommendation

Apply the workaround using next build --webpack until a more permanent solution is available, as it allows the app to function behind the enterprise WAF.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

nextjs - 💡(How to fix) Fix Turbopack chunk filenames containing ~ (tilde) blocked by enterprise WAFs [1 comments, 2 participants]