django.middleware.clickjacking.XFrameOptionsMiddleware enabled. What does this middleware do to protect your site?The XFrameOptionsMiddleware adds the X-Frame-Options HTTP header to responses. This header tells browsers not to allow the page to be shown inside a frame or iframe on other sites, preventing clickjacking attacks.
settings.py correctly enables this?The correct setting is X_FRAME_OPTIONS with values like 'DENY' or 'SAMEORIGIN'. This controls the X-Frame-Options header.
django.middleware.clickjacking.XFrameOptionsMiddleware to your middleware list, but the X-Frame-Options header is missing in responses. What is a likely cause?If the clickjacking middleware is after middleware that returns a response early (like caching or authentication middleware), it might never run. Middleware order matters.
X_FRAME_OPTIONS = 'SAMEORIGIN' in Django settings, what will be the value of the X-Frame-Options header in HTTP responses?The X_FRAME_OPTIONS setting value is sent as the header value. 'SAMEORIGIN' means only pages from the same origin can frame the content.
X_FRAME_OPTIONS to either 'DENY' or 'SAMEORIGIN'. Why might 'SAMEORIGIN' be a better choice in some cases?'SAMEORIGIN' allows pages from your own domain to frame your content. This is useful if your site uses frames internally, like in the Django admin interface. 'DENY' blocks all framing, which can break such features.