[GH-ISSUE #1672] Map remote tool, add support for overriding method #1665

Closed
opened 2026-03-03 19:53:18 +03:00 by kerem · 3 comments
Owner

Originally created by @webuniverseio on GitHub (Jun 8, 2023).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1672

Description

image

In map remote tool you can override schema, ports, host, etc but there is no option to override method

Why this feature/change is important?

When you're working with graphql in dev you may be using POST method, but in prod, in order to use persistent queries you may be using GET method. When remapping dev to prod I currently can't use map remote tool in this case because I can't change method (so when request in browser is made as POST, it arrives as POST to mapped host).

Please consider adding support for this use case, thank you!

Originally created by @webuniverseio on GitHub (Jun 8, 2023). Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1672 ## Description <img width="854" alt="image" src="https://github.com/ProxymanApp/Proxyman/assets/911388/843e273e-a716-435e-a34d-00167eebfe61"> In map remote tool you can override schema, ports, host, etc but there is no option to override method ## Why this feature/change is important? When you're working with graphql in dev you may be using POST method, but in prod, in order to use persistent queries you may be using GET method. When remapping dev to prod I currently can't use map remote tool in this case because I can't change method (so when request in browser is made as POST, it arrives as POST to mapped host). Please consider adding support for this use case, thank you!
kerem 2026-03-03 19:53:18 +03:00
Author
Owner

@NghiaTranUIT commented on GitHub (Jun 9, 2023):

@webuniverseio

Can you simply use the Scripting to achieve the same thing?

It's really simply to translate your Map Remote to the JS code: Here is the sample:

function onRequest(context, url, request) {
    request.scheme = "https";
    request.host = "freshgrocery.com";
    request.port = 443;
    request.path = "graphql";
    return request;
}

All Snippet code: https://docs.proxyman.io/scripting/snippet-code#change-request-destination-scheme-host-port-path

<!-- gh-comment-id:1583850080 --> @NghiaTranUIT commented on GitHub (Jun 9, 2023): @webuniverseio Can you simply use the Scripting to achieve the same thing? It's really simply to translate your Map Remote to the JS code: Here is the sample: ```js function onRequest(context, url, request) { request.scheme = "https"; request.host = "freshgrocery.com"; request.port = 443; request.path = "graphql"; return request; } ``` All Snippet code: https://docs.proxyman.io/scripting/snippet-code#change-request-destination-scheme-host-port-path
Author
Owner

@webuniverseio commented on GitHub (Jun 9, 2023):

Hi @NghiaTranUIT , this is true I thought I could use scripting but I find it would be even simpler to have that option in map remote tooling since all other remapping are already present and that is the only one which I wish was there.

Thank you for the snippet!

<!-- gh-comment-id:1584489807 --> @webuniverseio commented on GitHub (Jun 9, 2023): Hi @NghiaTranUIT , this is true I thought I could use scripting but I find it would be even simpler to have that option in map remote tooling since all other remapping are already present and that is the only one which I wish was there. Thank you for the snippet!
Author
Owner

@webuniverseio commented on GitHub (Jun 9, 2023):

I gave scripting a try, it worked fairly well, but I had to do a bit extra to set query parameters. Lets say I have a query like this which I need to remap

operationName=abc&variables=%7B%22token%22%3A%225816f.252887b7439-043x17894-1-351-1885637-0%22%7D&extensions=%7B%22persistedQuery%22%3A%7B%22version%22%3A1%2C%22hash%22%3A%2269dee5de054b01ca8ec88048011d6ba3e31e59442ac78525e437745135ec927a%22%7D%7D

I had to first split that string by &, then reassign values to request.queries[key] = value and value had to be url decoded. I learned something about scripting which is helpful, but I wish there was a simpler way (scripting samples mention just request.queries[x]).

I also had to set a cookie header to avoid auth error for backend api, so looks like I could not avoid scripting in the first place. Thanks for your help with this, I'll close this ticket.

<!-- gh-comment-id:1584533561 --> @webuniverseio commented on GitHub (Jun 9, 2023): I gave scripting a try, it worked fairly well, but I had to do a bit extra to set query parameters. Lets say I have a query like this which I need to remap ``` operationName=abc&variables=%7B%22token%22%3A%225816f.252887b7439-043x17894-1-351-1885637-0%22%7D&extensions=%7B%22persistedQuery%22%3A%7B%22version%22%3A1%2C%22hash%22%3A%2269dee5de054b01ca8ec88048011d6ba3e31e59442ac78525e437745135ec927a%22%7D%7D ``` I had to first split that string by &, then reassign values to request.queries[key] = value and value had to be url decoded. I learned something about scripting which is helpful, but I wish there was a simpler way (scripting samples mention just request.queries[x]). I also had to set a cookie header to avoid auth error for backend api, so looks like I could not avoid scripting in the first place. Thanks for your help with this, I'll close this ticket.
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#1665
No description provided.