# Remove HttpOnly cookie using serverless

**URL:** <https://community.hubspot.com/t/remove-httponly-cookie-using-serverless/89482>\
**Category:** APIs & Integrations\
**Tags:** professional\
**Created:** [September 12, 2023, 6:26pm UTC](https://community.hubspot.com/t/remove-httponly-cookie-using-serverless/89482 "2023-09-12T18:26:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![CBelga](https://avatars.discourse-cdn.com/v4/letter/c/13edae/32.png) [@CBelga](https://community.hubspot.com/u/CBelga)\
**Post date:** [September 12, 2023, 6:26pm UTC](https://community.hubspot.com/t/remove-httponly-cookie-using-serverless/89482/1 "2023-09-12T18:26:52Z")

</div>

Has anyone here tried removing a HttpOnly cookie using the serverless “Set-Cookie” following this [documentation](https://developers.hubspot.com/docs/cms/data/serverless-functions/reference#set-cookies-from-your-endpoint)?

Below is a sendResponse in my serverless.

`sendResponse({ body: {message: `Cookie ${cookieName} deleted successfully`}, "Set-Cookie": `${cookieName}=; expires=Thu, 01 Jan 1970 00:00:01 GMT; path=/; [domain=.hs-sites.com](http://domain=.hs-sites.com); httpOnly=true;secure`, statusCode: 200 }); `

---

<div class="post-metadata">

**Author:** ![Jaycee\_Lewis](https://d10pqhm3lwygmk.cloudfront.net/user_avatar/community.hubspot.com/jaycee_lewis/32/61352_2.png) [@Jaycee\_Lewis](https://community.hubspot.com/u/Jaycee_Lewis)\
**Post date:** [September 13, 2023, 7:49pm UTC](https://community.hubspot.com/t/remove-httponly-cookie-using-serverless/89482/2 "2023-09-13T19:49:25Z")

</div>

Hi, @CBelga 👋 Thank you for the interesting question!

I’d like to invite some of our community members to the conversation. Hey, @Teun @louischausse @Kevin-C @DHolland @stefen, do you have any recent experience you can share with @CBelga?

Thank you for taking a look! — Jaycee

---

<div class="post-metadata">

**Author:** ![CBelga](https://avatars.discourse-cdn.com/v4/letter/c/13edae/32.png) [@CBelga](https://community.hubspot.com/u/CBelga)\
**Post date:** [September 13, 2023, 8:00pm UTC](https://community.hubspot.com/t/remove-httponly-cookie-using-serverless/89482/3 "2023-09-13T20:00:30Z")

</div>

I’ve developed a private, password-protected webpage on HubSpot. When a user enters the correct password, a cookie named “\_key” followed by random numbers (e.g. 124794456884\_key) is generated. If this cookie is manually deleted, the user is prompted to re-enter the password upon revisiting the page. I want to enable the manual deletion of this cookie when the user clicks a logout button or link. However, the cookie is HttpOnly, meaning it can only be removed server-side. I attempted to use a serverless function and “Set-Cookie”, but it was unsuccessful.
