[GH-ISSUE #1862] Delete specific cookie in scripting #1854

Closed
opened 2026-03-03 19:54:58 +03:00 by kerem · 3 comments
Owner

Originally created by @Agrailag on GitHub (Nov 29, 2023).
Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1862

Description

Hello, not very familiar with js, but in snippets don't find any example - how i can remove some specific cookie in Cookie header?

delete request.headers["Cookie"] = "JSESSIONID";
Something like this delete whole header.

Originally created by @Agrailag on GitHub (Nov 29, 2023). Original GitHub issue: https://github.com/ProxymanApp/Proxyman/issues/1862 ## Description Hello, not very familiar with js, but in snippets don't find any example - how i can remove some specific cookie in Cookie header? ` delete request.headers["Cookie"] = "JSESSIONID"; ` Something like this delete whole header.
kerem 2026-03-03 19:54:58 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@NghiaTranUIT commented on GitHub (Nov 30, 2023):

Hey @Agrailag

request.headers["Cookie"] is just a string, so you can write simple JS Logic to remove a part of it.

var cookies = request.headers["Cookie"];

// split it to array
var newCookies = cookies.split("; ")

// delete some part, for example: I want to delete the `_delighted_web` in the cookie
delete newCookies["_delighted_web"]

// reassign
request.headers["Cookie"] = newCookies.join("; ");

// done
return request;
<!-- gh-comment-id:1832975778 --> @NghiaTranUIT commented on GitHub (Nov 30, 2023): Hey @Agrailag `request.headers["Cookie"]` is just a string, so you can write simple JS Logic to remove a part of it. ```js var cookies = request.headers["Cookie"]; // split it to array var newCookies = cookies.split("; ") // delete some part, for example: I want to delete the `_delighted_web` in the cookie delete newCookies["_delighted_web"] // reassign request.headers["Cookie"] = newCookies.join("; "); // done return request; ```
Author
Owner

@Agrailag commented on GitHub (Nov 30, 2023):

@NghiaTranUIT hey, thanks for answer. But in this case delete newCookies["_delighted_web"] i suppose it wont delete cookie just by key, right?

<!-- gh-comment-id:1833274246 --> @Agrailag commented on GitHub (Nov 30, 2023): @NghiaTranUIT hey, thanks for answer. But in this case `delete newCookies["_delighted_web"]` i suppose it wont delete cookie just by key, right?
Author
Owner

@NghiaTranUIT commented on GitHub (Dec 1, 2023):

it deletes a part key-value of your cookie. You can use JS Playground on the Internet and test it.

<!-- gh-comment-id:1835230620 --> @NghiaTranUIT commented on GitHub (Dec 1, 2023): it deletes a part key-value of your cookie. You can use JS Playground on the Internet and test it.
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#1854
No description provided.