[GH-ISSUE #966] Map Remote can not change path prefix #960

Closed
opened 2026-03-03 19:23:22 +03:00 by kerem · 2 comments
Owner

Originally created by @ace-express on GitHub (Aug 25, 2021).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/966

Originally assigned to: @NghiaTranUIT on GitHub.

Proxyman version? (Ex. Proxyman 1.4.3)

Version 2.31.0 (23100)

Map Remote Can not map: http://a.com/v1/xxxx to http://a.com/v2/xxxx

Originally created by @ace-express on GitHub (Aug 25, 2021). Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/966 Originally assigned to: @NghiaTranUIT on GitHub. ### Proxyman version? (Ex. Proxyman 1.4.3) Version 2.31.0 (23100) Map Remote Can not map: http://a.com/v1/xxxx to http://a.com/v2/xxxx
kerem closed this issue 2026-03-03 19:23:22 +03:00
Author
Owner

@NghiaTranUIT commented on GitHub (Aug 25, 2021):

Hey @liufengsoft, Map Remote could not understand how to replace v1 to v2.

You can easily do it by using Scripting Tools.

Here is the sample code how to map v1 to v2 👍
Snipped Code: https://docs.proxyman.io/scripting/snippet-code#change-request-destination-scheme-host-port-path

function onRequest(context, url, request) {
  
  var newPath = request.path.replace("v1", "v2");
  request.path = newPath

  // Done
  return request;
}
Screen Shot 2021-08-25 at 10 51 24
<!-- gh-comment-id:905161001 --> @NghiaTranUIT commented on GitHub (Aug 25, 2021): Hey @liufengsoft, Map Remote could not understand how to replace v1 to v2. You can easily do it by using Scripting Tools. Here is the sample code how to map v1 to v2 👍 Snipped Code: https://docs.proxyman.io/scripting/snippet-code#change-request-destination-scheme-host-port-path ```js function onRequest(context, url, request) { var newPath = request.path.replace("v1", "v2"); request.path = newPath // Done return request; } ``` <img width="1564" alt="Screen Shot 2021-08-25 at 10 51 24" src="https://user-images.githubusercontent.com/5878421/130723710-5dc6378f-4963-4d3f-b965-7f74357789e4.png">
Author
Owner

@ace-express commented on GitHub (Aug 26, 2021):

Hey @liufengsoft, Map Remote could not understand how to replace v1 to v2.

You can easily do it by using Scripting Tools.

Here is the sample code how to map v1 to v2 👍
Snipped Code: https://docs.proxyman.io/scripting/snippet-code#change-request-destination-scheme-host-port-path

function onRequest(context, url, request) {
  
  var newPath = request.path.replace("v1", "v2");
  request.path = newPath

  // Done
  return request;
}
Screen Shot 2021-08-25 at 10 51 24

thanks you reply, this works very well.

How can I directly support it in Map Remote? Currently Charles can support it, like this:

remote path config: /v1/*
target path config: /

<!-- gh-comment-id:906067407 --> @ace-express commented on GitHub (Aug 26, 2021): > Hey @liufengsoft, Map Remote could not understand how to replace v1 to v2. > > You can easily do it by using Scripting Tools. > > Here is the sample code how to map v1 to v2 👍 > Snipped Code: https://docs.proxyman.io/scripting/snippet-code#change-request-destination-scheme-host-port-path > > ```js > function onRequest(context, url, request) { > > var newPath = request.path.replace("v1", "v2"); > request.path = newPath > > // Done > return request; > } > ``` > > <img alt="Screen Shot 2021-08-25 at 10 51 24" width="1564" src="https://user-images.githubusercontent.com/5878421/130723710-5dc6378f-4963-4d3f-b965-7f74357789e4.png"> thanks you reply, this works very well. How can I directly support it in Map Remote? Currently Charles can support it, like this: remote path config: /v1/* target path config: /
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/Proxyman#960
No description provided.