<!--
{
  "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/httpShouldSetCookies",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Foundation"
    ],
    "preciseIdentifier" : "c:objc(cs)NSURLSessionConfiguration(py)HTTPShouldSetCookies"
  },
  "title" : "httpShouldSetCookies"
}
-->

# httpShouldSetCookies

A Boolean value that determines whether requests should contain cookies from the cookie store.

```
var httpShouldSetCookies: Bool { get set }
```

## Discussion

This property controls whether tasks within sessions based on this configuration should automatically provide cookies from the shared cookie store when making requests.

If you want to provide cookies yourself, set this value to <doc://com.apple.documentation/documentation/Swift/false> and provide a `Cookie` header either through the session’s [`httpAdditionalHeaders`](/documentation/Foundation/URLSessionConfiguration/httpAdditionalHeaders) property or on a per-request level using a custom [`NSURLRequest`](/documentation/Foundation/NSURLRequest) object.

The default value is <doc://com.apple.documentation/documentation/Swift/true>.

---

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)