[GH-ISSUE #1955] Changing URL in scripting #1948

Closed
opened 2026-03-03 19:55:41 +03:00 by kerem · 1 comment
Owner

Originally created by @novitae on GitHub (Mar 4, 2024).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1955

Description

When making a script, and in onRequest doing request.url = "https://mynew.url/", the URL of the request doesn't change. Is it normal ?

Steps to Reproduce

Current Behavior

Url not changed

Expected Behavior

Url changed to the new one

Environment

  • App version: Proxyman Version 5.0.0
  • macOS version: 14.2.1
Originally created by @novitae on GitHub (Mar 4, 2024). Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1955 ## Description When making a script, and in `onRequest` doing `request.url = "https://mynew.url/"`, the URL of the request doesn't change. Is it normal ? ## Steps to Reproduce ## Current Behavior Url not changed ## Expected Behavior Url changed to the new one ## Environment - App version: Proxyman Version 5.0.0 - macOS version: 14.2.1
kerem 2026-03-03 19:55:41 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@NghiaTranUIT commented on GitHub (Mar 5, 2024):

It's because request.url is read-only.

To change the URL components, please use the code:

function onRequest(context, url, request) {
    request.scheme = "http";
    request.host = "proxyman.dev";
    request.port = 9090;
    request.path = "v1/data/user";
    return request;
}

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

<!-- gh-comment-id:1977809770 --> @NghiaTranUIT commented on GitHub (Mar 5, 2024): It's because `request.url` is read-only. To change the URL components, please use the code: ```js function onRequest(context, url, request) { request.scheme = "http"; request.host = "proxyman.dev"; request.port = 9090; request.path = "v1/data/user"; return request; } ``` Snippet Code: https://docs.proxyman.io/scripting/snippet-code#change-request-destination-scheme-host-port-path
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#1948
No description provided.