Search code examples
djangotinymce

When using django-tinymce, where do I specify referer?


I'm trying to integrate tinyMCE with a django app. I have the following specified in my settings.py:


TINYMCE_JS_URL = "https://cdn.tiny.cloud/1/<my api key>/tinymce/6/tinymce.min.js";

tinyMCE does display, but it's giving me the following message:

We’re unable to check your domain because the referer header is missing. Please read the Guide on how to ensure your referer header is present, so we can then customize your editor experience.

Where do I specify the referer header?

I tried putting

'referrer_policy': 'origin',

in my TINYMCE_DEFAULT_CONFIG, but I still get the error.


Solution

  • You can set the referrer policy in your applications settings.py (or equivilant).

    SECURE_REFERRER_POLICY¶

    Default: 'same-origin'

    If configured, the SecurityMiddleware sets the Referrer Policy header on all responses that do not already have it to the value provided.

    So if you set the following you should get the result you are looking for.

    SECURE_REFERRER_POLICY = 'origin'
    

    More information on the referrer policy can be found here: https://docs.djangoproject.com/en/5.0/ref/middleware/#referrer-policy