I'm working on converting an application to render its content in WKWebView from UIWebView. The application itself is a mix of native iOS UI and web components and there are multiple web views. I've created a shared WKProcessPool that each WKWebView instance gets via a common initialization path that has logic to create an identical WKWebViewConfiguration for each instance from a base configuration instance. Upon logging into the application, I call setCookie on the base configuration instance and don't allow the user to proceed into the application until after the cookie has been set.
When I attempt to load content in the generated WKWebViews, I get a 401 from our server indicating that the user is not logged in. While debugging, I've confirmed that the cookie is in the web view's cookie store. I was able to get around this by overriding decidePolicyForNavigationAction and setting the cookie value as an HTTP header field. However, I feel like this step should not be needed since the cookie is already present in the cookie store and the content that is being loaded is for that same domain. Is there a way to force cookie attachment on all requests by default or is it necessary to set the cookie as a header value on the request?