How to set cookies cookies as Secure/HttpOnly/SameSite
I'm asking and answering a question, in case anyone else experiences the same issue.
After a security audit we needed to try to make cookies Secure, HttpOnly, and SameSite.
Setting the AppSetting <add key="Umbraco.Core.UseHttps" value="true" /> might resolve the Secure issue, but our site runs as Http on IIS and the SSL is offloaded by the CDN.
Now UMB_MCULTURE is only ever set and read by JavaScript. That means it is never in a HTTP response for me to modify. We'd need to create some JavaScript to update the cookie.
Setting UMB-XSRF-TOKEN or UMB_PREVIEW to HttpOnly breaks the BackOffice because the value is used by JavaScript.
How to set cookies cookies as Secure/HttpOnly/SameSite
I'm asking and answering a question, in case anyone else experiences the same issue.
After a security audit we needed to try to make cookies Secure, HttpOnly, and SameSite.
Setting the AppSetting
<add key="Umbraco.Core.UseHttps" value="true" />
might resolve the Secure issue, but our site runs as Http on IIS and the SSL is offloaded by the CDN.I achieved this by:
Now
UMB_MCULTURE
is only ever set and read by JavaScript. That means it is never in a HTTP response for me to modify. We'd need to create some JavaScript to update the cookie.Setting
UMB-XSRF-TOKEN
orUMB_PREVIEW
toHttpOnly
breaks the BackOffice because the value is used by JavaScript.This should be part of the official docs!
Thank you, David!
is working on a reply...