<!--
{
  "availability" : [
    "iOS: 7.0.0 -",
    "iPadOS: 7.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.9.0 -",
    "tvOS: 9.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 2.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Foundation",
  "identifier" : "/documentation/Foundation/URLSessionConfiguration/httpCookieAcceptPolicy",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSURLSessionConfiguration(py)HTTPCookieAcceptPolicy"
  },
  "title" : "httpCookieAcceptPolicy"
}
-->

# httpCookieAcceptPolicy

A policy constant that determines when cookies should be accepted.

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

## Discussion

This property determines the cookie accept policy for all tasks within sessions based on this configuration.

The default value is [`HTTPCookie.AcceptPolicy.onlyFromMainDocumentDomain`](/documentation/Foundation/HTTPCookie/AcceptPolicy/onlyFromMainDocumentDomain). You can change it to any of the constants defined in the [`HTTPCookie.AcceptPolicy`](/documentation/Foundation/HTTPCookie/AcceptPolicy) enumerated type.

If you want more direct control over what cookies are accepted, set this value to [`HTTPCookie.AcceptPolicy.never`](/documentation/Foundation/HTTPCookie/AcceptPolicy/never) and then use the [`allHeaderFields`](/documentation/Foundation/HTTPURLResponse/allHeaderFields) and [`cookies(withResponseHeaderFields:for:)`](/documentation/Foundation/HTTPCookie/cookies(withResponseHeaderFields:for:)) methods to extract cookies from the URL response object yourself.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)