class documentation

class XFrameOptionsMiddleware(MiddlewareMixin):

View In Hierarchy

Set the X-Frame-Options HTTP header in HTTP responses.

Do not set the header if it's already set or if the response contains a xframe_options_exempt value set to True.

By default, set the X-Frame-Options header to 'SAMEORIGIN', meaning the response can only be loaded on a frame within the same site. To prevent the response from being loaded in a frame in any site, set X_FRAME_OPTIONS in your project's Django settings to 'DENY'.

Method get​_xframe​_options​_value Get the value to set for the X_FRAME_OPTIONS header. Use the value from the X_FRAME_OPTIONS setting, or 'DENY' if not set.
Method process​_response Undocumented

Inherited from MiddlewareMixin:

Async Method __acall__ Async version of __call__ that is swapped in when an async request is running.
Method __call__ Undocumented
Method __init__ Undocumented
Method __repr__ Undocumented
Method ​_async​_check If get_response is a coroutine function, turns us into async mode so a thread is not consumed during a whole request.
Class Variable async​_capable Undocumented
Class Variable sync​_capable Undocumented
Instance Variable ​_is​_coroutine Undocumented
Instance Variable get​_response Undocumented
def get_xframe_options_value(self, request, response):

Get the value to set for the X_FRAME_OPTIONS header. Use the value from the X_FRAME_OPTIONS setting, or 'DENY' if not set.

This method can be overridden if needed, allowing it to vary based on the request or response.

def process_response(self, request, response):

Undocumented