Skip to content

testProxy breaks axios with Basic Auth #82611

@jokklan

Description

@jokklan

Link to the code that reproduces this issue

https://github.com/jokklan/nextjs-reproduce-app

To Reproduce

  1. Call any endpoint with axios including basic auth credentials in the auth options key (this works)
  2. Change experimental.testProxy to true in next.config.ts
  3. Make the same axios request as in Added css using aphrodite #1, now it fails with "Request cannot be constructed from a URL that includes credential: https://user:pass@domain/path"

Current vs. Expected behavior

Changing testProxy should not change the behaviour of axios request.

Provide environment information

Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.4.0: Fri Apr 11 18:32:50 PDT 2025; root:xnu-11417.101.15~117/RELEASE_ARM64_T6041
  Available memory (MB): 24576
  Available CPU cores: 12
Binaries:
  Node: 22.16.0
  npm: 10.9.2
  Yarn: N/A
  pnpm: N/A
Relevant Packages:
  next: 15.4.2-canary.44 // Latest available version is detected (15.4.2-canary.44).
  eslint-config-next: N/A
  react: 19.1.1
  react-dom: 19.1.1
  typescript: 5.9.2
Next.js Config:
  output: N/A

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

Runtime

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

next dev (local)

Additional context

Changing the axios adapter to fetch is a temporary fix for this issue, it only happens when using the http adapter which is default for node requests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    RuntimeRelated to Node.js or Edge Runtime with Next.js.

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions