---
title: setcookie.get_value_by_name
summary: null
url: >-
  https://www.fastly.com/documentation/reference/vcl/functions/miscellaneous/setcookie-get-value-by-name
---

```
STRING setcookie.get_value_by_name(ID where, STRING cookie_name)
```

**Available in:** all subroutines

Returns a value associated with the `cookie_name` in the `Set-Cookie` header
contained in the HTTP response indicated by `where`. An _unset_ value is returned
if a cookie is not found or on error. In the `vcl_fetch` method, the `beresp` 
response is available. In `vcl_deliver` and `vcl_log`, the `resp` response is 
available.

If multiple cookies of the same name are present in the response, the value of 
the last one will be returned.

When this function does not have enough memory to succeed, the request is
failed.

This function conforms to [RFC 6265](https://tools.ietf.org/html/rfc6265).

## Example

```vcl
set resp.http.MyValue = setcookie.get_value_by_name(resp, "myvalue");
```
