---
title: httpCookieAcceptPolicy
framework: foundation
role: symbol
role_heading: Instance Property
path: foundation/urlsessionconfiguration/httpcookieacceptpolicy
---

# httpCookieAcceptPolicy

A policy constant that determines when cookies should be accepted.

## Declaration

```swift
var httpCookieAcceptPolicy: HTTPCookie.AcceptPolicy { get set }
```

## Discussion

Discussion This property determines the cookie accept policy for all tasks within sessions based on this configuration. The default value is HTTPCookie.AcceptPolicy.onlyFromMainDocumentDomain. You can change it to any of the constants defined in the HTTPCookie.AcceptPolicy enumerated type. If you want more direct control over what cookies are accepted, set this value to HTTPCookie.AcceptPolicy.never and then use the allHeaderFields and cookies(withResponseHeaderFields:for:) methods to extract cookies from the URL response object yourself.

## See Also

### Setting cookie policies

- [httpShouldSetCookies](foundation/urlsessionconfiguration/httpshouldsetcookies.md)
- [httpCookieStorage](foundation/urlsessionconfiguration/httpcookiestorage.md)
- [HTTPCookie](foundation/httpcookie.md)
