Search code examples
djangofacebook-messenger-bot

X-FRAME OPTIONS in Facebook Messenger


I am creating a facebook chatbot and using Django for the backend. The documentation states this regarding webviews on the web. enter image description here

Which is the best way to achieve this in Django?


Solution

  • Modern browsers honor the X-Frame-Options HTTP header that indicates whether or not a resource is allowed to load within a frame or iframe.

    You can add this to your settings.py

    X_FRAME_OPTIONS = 'ALLOW-FROM https://www.facebook.com/ https://www.messenger.com/'
    

    Note: This will use same X-Frame-Options header value for all responses in your site

    If you want to set the X-Frame-Options header on a per view basis, Read the docs