Angular: How to fix SameSite Cookie issue

Viewed 7481

My application is on dev-server. It is working in all platforms except Facebook app browser in mobile, although its working on chrome mobile browser.

I wasted so many hours and after that I discovered this warning regarding SameSite Cookie: enter image description here

I've read instructions from https://web.dev/samesite-cookies-explained/

My project is running by Angular. I don't know whether I have to set the set-cookie as ideal Cookie or in Request/Response header.

I've already tried as Request Header like https://angular.io/guide/http#adding-headers. And I don't have idea how to set-cookie in Response Header.

I also don't know any other alternatives.

1 Answers

In web.config you can add SameSite attribute.

<configuration>
    <system.webServer>
     <httpProtocol>
         <customHeaders>
            <add name="X-Content-Type-Options" value="nosniff" />
            <add name="SameSite" value="lax" />
         </customHeaders>
      </httpProtocol>
    </system.webServer>
</configuration>
Related