Search code examples
djangodjango-channelscross-origin-opener-policy

The Cross Origin Opener Policy header has been ignored - DJANGO


Im making a Chatapp project in Django. I implemented channels and websockets to send and receive message and this worked when i tested using two differents windows in the same browser (one of them in incognito mode), but when i try to test it using another browser i get the following error:

Cross Origin Opener Policy error

I tried to solve implementing django corsheaders with the following configuration:

Corsheaders app installation

Corsheaders middleware

Corsheaders settings

(I know that setting all origins to true its not recommendable but it's just for testing purpouses)


Solution

  • In settings.py, you have to set SECURE_CROSS_ORIGIN_OPENER_POLICY = None

    Default value is same-origin

    https://django.readthedocs.io/en/stable/ref/settings.html#std-setting-SECURE_CROSS_ORIGIN_OPENER_POLICY

    https://adamj.eu/tech/2021/05/01/how-to-set-coep-coop-corp-security-headers-in-django/