Skip to content

applyPathRewrite logs old req.url instead of rewritten path #1156

@nicoabie

Description

@nicoabie

Checks

Describe the bug (be clear and concise)

When debugging with export DEBUG=http-proxy-middleware* applyPathRewrite function logs the old path

Step-by-step reproduction instructions

1. use `pathRewrite`
2. debug it

Expected behavior (be clear and concise)

it should log path variable instead

How is http-proxy-middleware used in your project?

we need to proxy supabase auth.

What http-proxy-middleware configuration are you using?

{
		target: new url.URL("/auth", SUPABASE_URL).toString(),
		changeOrigin: true,
		pathRewrite: {
			"^/v2": "/v1",
		},
		headers: {
			apikey: ANON_TOKEN,
		},
		logger: baseLogger.child({ name: "supabase-auth-proxy" }),
		selfHandleResponse: !!interceptor,
		on: {
			proxyReq: fixRequestBody,
			...(interceptor ? { proxyRes: responseInterceptor(interceptor) } : {}),
		},
	}

What OS/version and node/version are you seeing the problem?

System:
    OS: macOS 26.1
    CPU: (12) arm64 Apple M4 Pro
    Memory: 104.22 MB / 24.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 24.12.0 - /Users/admin/.nvm/versions/node/v24.12.0/bin/node
    Yarn: 1.22.22 - /Users/admin/.nvm/versions/node/v22.12.0/bin/yarn
    npm: 11.6.2 - /Users/admin/.nvm/versions/node/v24.12.0/bin/npm
  Managers:
    CocoaPods: 1.16.2 - /opt/homebrew/bin/pod
    Homebrew: 5.0.7 - /opt/homebrew/bin/brew
    pip3: 21.2.4 - /usr/bin/pip3
    RubyGems: 3.0.3.1 - /usr/bin/gem
  Utilities:
    Make: 3.81 - /usr/bin/make
    GCC: 17.0.0 - /usr/bin/gcc
    Git: 2.50.1 - /usr/bin/git
    Clang: 17.0.0 - /usr/bin/clang
    Curl: 8.7.1 - /usr/bin/curl
    OpenSSL: 3.6.0 - /opt/homebrew/bin/openssl
  Servers:
    Apache: 2.4.62 - /usr/sbin/apachectl
  Virtualization:
    Docker: 28.5.1 - /usr/local/bin/docker
    Docker Compose: 2.40.2 - /usr/local/bin/docker-compose
  SDKs:
    iOS SDK:
      Platforms: DriverKit 25.1, iOS 26.1, macOS 26.1, tvOS 26.1, visionOS 26.1, watchOS 26.1
  IDEs:
    Android Studio: 2025.1 AI-251.27812.49.2514.14217341
    Cursor: 2.2.43 - /usr/local/bin/cursor
    Vim: 9.1 - /usr/bin/vim
    Xcode: 26.1.1/17B100 - /usr/bin/xcodebuild
  Languages:
    Bash: 3.2.57 - /bin/bash
    Java: 21.0.9 - /usr/bin/javac
    Perl: 5.34.1 - /usr/bin/perl
    Python3: 3.9.6 - /usr/bin/python3
    Ruby: 2.6.10 - /usr/bin/ruby
  Databases:
    SQLite: 3.44.4 - /Users/admin/Library/Android/sdk/platform-tools/sqlite3
  Browsers:
    Firefox: 145.0.2
    Safari: 26.1

Additional context (optional)

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions