Amazon CloudFront

2022/12/30 - Amazon CloudFront - 5 updated api methods

Changes  Extend response headers policy to support removing headers from viewer responses

CreateResponseHeadersPolicy (updated) Link ¶
Changes (request, response)
Request
{'ResponseHeadersPolicyConfig': {'RemoveHeadersConfig': {'Items': [{'Header': 'string'}],
                                                         'Quantity': 'integer'}}}
Response
{'ResponseHeadersPolicy': {'ResponseHeadersPolicyConfig': {'RemoveHeadersConfig': {'Items': [{'Header': 'string'}],
                                                                                   'Quantity': 'integer'}}}}

Creates a response headers policy.

A response headers policy contains information about a set of HTTP headers. To create a response headers policy, you provide some metadata about the policy and a set of configurations that specify the headers.

After you create a response headers policy, you can use its ID to attach it to one or more cache behaviors in a CloudFront distribution. When it's attached to a cache behavior, the response headers policy affects the HTTP headers that CloudFront includes in HTTP responses to requests that match the cache behavior. CloudFront adds or removes response headers according to the configuration of the response headers policy.

For more information, see Adding or removing HTTP headers in CloudFront responses in the Amazon CloudFront Developer Guide .

See also: AWS API Documentation

Request Syntax

client.create_response_headers_policy(
    ResponseHeadersPolicyConfig={
        'Comment': 'string',
        'Name': 'string',
        'CorsConfig': {
            'AccessControlAllowOrigins': {
                'Quantity': 123,
                'Items': [
                    'string',
                ]
            },
            'AccessControlAllowHeaders': {
                'Quantity': 123,
                'Items': [
                    'string',
                ]
            },
            'AccessControlAllowMethods': {
                'Quantity': 123,
                'Items': [
                    'GET'|'POST'|'OPTIONS'|'PUT'|'DELETE'|'PATCH'|'HEAD'|'ALL',
                ]
            },
            'AccessControlAllowCredentials': True|False,
            'AccessControlExposeHeaders': {
                'Quantity': 123,
                'Items': [
                    'string',
                ]
            },
            'AccessControlMaxAgeSec': 123,
            'OriginOverride': True|False
        },
        'SecurityHeadersConfig': {
            'XSSProtection': {
                'Override': True|False,
                'Protection': True|False,
                'ModeBlock': True|False,
                'ReportUri': 'string'
            },
            'FrameOptions': {
                'Override': True|False,
                'FrameOption': 'DENY'|'SAMEORIGIN'
            },
            'ReferrerPolicy': {
                'Override': True|False,
                'ReferrerPolicy': 'no-referrer'|'no-referrer-when-downgrade'|'origin'|'origin-when-cross-origin'|'same-origin'|'strict-origin'|'strict-origin-when-cross-origin'|'unsafe-url'
            },
            'ContentSecurityPolicy': {
                'Override': True|False,
                'ContentSecurityPolicy': 'string'
            },
            'ContentTypeOptions': {
                'Override': True|False
            },
            'StrictTransportSecurity': {
                'Override': True|False,
                'IncludeSubdomains': True|False,
                'Preload': True|False,
                'AccessControlMaxAgeSec': 123
            }
        },
        'ServerTimingHeadersConfig': {
            'Enabled': True|False,
            'SamplingRate': 123.0
        },
        'CustomHeadersConfig': {
            'Quantity': 123,
            'Items': [
                {
                    'Header': 'string',
                    'Value': 'string',
                    'Override': True|False
                },
            ]
        },
        'RemoveHeadersConfig': {
            'Quantity': 123,
            'Items': [
                {
                    'Header': 'string'
                },
            ]
        }
    }
)
type ResponseHeadersPolicyConfig

dict

param ResponseHeadersPolicyConfig

[REQUIRED]

Contains metadata about the response headers policy, and a set of configurations that specify the HTTP headers.

  • Comment (string) --

    A comment to describe the response headers policy.

    The comment cannot be longer than 128 characters.

  • Name (string) -- [REQUIRED]

    A name to identify the response headers policy.

    The name must be unique for response headers policies in this Amazon Web Services account.

  • CorsConfig (dict) --

    A configuration for a set of HTTP response headers that are used for cross-origin resource sharing (CORS).

    • AccessControlAllowOrigins (dict) -- [REQUIRED]

      A list of origins (domain names) that CloudFront can use as the value for the Access-Control-Allow-Origin HTTP response header.

      For more information about the Access-Control-Allow-Origin HTTP response header, see Access-Control-Allow-Origin in the MDN Web Docs.

      • Quantity (integer) -- [REQUIRED]

        The number of origins in the list.

      • Items (list) -- [REQUIRED]

        The list of origins (domain names). You can specify * to allow all origins.

        • (string) --

    • AccessControlAllowHeaders (dict) -- [REQUIRED]

      A list of HTTP header names that CloudFront includes as values for the Access-Control-Allow-Headers HTTP response header.

      For more information about the Access-Control-Allow-Headers HTTP response header, see Access-Control-Allow-Headers in the MDN Web Docs.

      • Quantity (integer) -- [REQUIRED]

        The number of HTTP header names in the list.

      • Items (list) -- [REQUIRED]

        The list of HTTP header names. You can specify * to allow all headers.

        • (string) --

    • AccessControlAllowMethods (dict) -- [REQUIRED]

      A list of HTTP methods that CloudFront includes as values for the Access-Control-Allow-Methods HTTP response header.

      For more information about the Access-Control-Allow-Methods HTTP response header, see Access-Control-Allow-Methods in the MDN Web Docs.

      • Quantity (integer) -- [REQUIRED]

        The number of HTTP methods in the list.

      • Items (list) -- [REQUIRED]

        The list of HTTP methods. Valid values are:

        • GET

        • DELETE

        • HEAD

        • OPTIONS

        • PATCH

        • POST

        • PUT

        • ALL

        ALL is a special value that includes all of the listed HTTP methods.

        • (string) --

    • AccessControlAllowCredentials (boolean) -- [REQUIRED]

      A Boolean that CloudFront uses as the value for the Access-Control-Allow-Credentials HTTP response header.

      For more information about the Access-Control-Allow-Credentials HTTP response header, see Access-Control-Allow-Credentials in the MDN Web Docs.

    • AccessControlExposeHeaders (dict) --

      A list of HTTP headers that CloudFront includes as values for the Access-Control-Expose-Headers HTTP response header.

      For more information about the Access-Control-Expose-Headers HTTP response header, see Access-Control-Expose-Headers in the MDN Web Docs.

      • Quantity (integer) -- [REQUIRED]

        The number of HTTP headers in the list.

      • Items (list) --

        The list of HTTP headers. You can specify * to expose all headers.

        • (string) --

    • AccessControlMaxAgeSec (integer) --

      A number that CloudFront uses as the value for the Access-Control-Max-Age HTTP response header.

      For more information about the Access-Control-Max-Age HTTP response header, see Access-Control-Max-Age in the MDN Web Docs.

    • OriginOverride (boolean) -- [REQUIRED]

      A Boolean that determines whether CloudFront overrides HTTP response headers received from the origin with the ones specified in this response headers policy.

  • SecurityHeadersConfig (dict) --

    A configuration for a set of security-related HTTP response headers.

    • XSSProtection (dict) --

      Determines whether CloudFront includes the X-XSS-Protection HTTP response header and the header's value.

      For more information about the X-XSS-Protection HTTP response header, see X-XSS-Protection in the MDN Web Docs.

      • Override (boolean) -- [REQUIRED]

        A Boolean that determines whether CloudFront overrides the X-XSS-Protection HTTP response header received from the origin with the one specified in this response headers policy.

      • Protection (boolean) -- [REQUIRED]

        A Boolean that determines the value of the X-XSS-Protection HTTP response header. When this setting is true , the value of the X-XSS-Protection header is 1 . When this setting is false , the value of the X-XSS-Protection header is 0 .

        For more information about these settings, see X-XSS-Protection in the MDN Web Docs.

      • ModeBlock (boolean) --

        A Boolean that determines whether CloudFront includes the mode=block directive in the X-XSS-Protection header.

        For more information about this directive, see X-XSS-Protection in the MDN Web Docs.

      • ReportUri (string) --

        A reporting URI, which CloudFront uses as the value of the report directive in the X-XSS-Protection header.

        You cannot specify a ReportUri when ModeBlock is true .

        For more information about using a reporting URL, see X-XSS-Protection in the MDN Web Docs.

    • FrameOptions (dict) --

      Determines whether CloudFront includes the X-Frame-Options HTTP response header and the header's value.

      For more information about the X-Frame-Options HTTP response header, see X-Frame-Options in the MDN Web Docs.

      • Override (boolean) -- [REQUIRED]

        A Boolean that determines whether CloudFront overrides the X-Frame-Options HTTP response header received from the origin with the one specified in this response headers policy.

      • FrameOption (string) -- [REQUIRED]

        The value of the X-Frame-Options HTTP response header. Valid values are DENY and SAMEORIGIN .

        For more information about these values, see X-Frame-Options in the MDN Web Docs.

    • ReferrerPolicy (dict) --

      Determines whether CloudFront includes the Referrer-Policy HTTP response header and the header's value.

      For more information about the Referrer-Policy HTTP response header, see Referrer-Policy in the MDN Web Docs.

      • Override (boolean) -- [REQUIRED]

        A Boolean that determines whether CloudFront overrides the Referrer-Policy HTTP response header received from the origin with the one specified in this response headers policy.

      • ReferrerPolicy (string) -- [REQUIRED]

        The value of the Referrer-Policy HTTP response header. Valid values are:

        • no-referrer

        • no-referrer-when-downgrade

        • origin

        • origin-when-cross-origin

        • same-origin

        • strict-origin

        • strict-origin-when-cross-origin

        • unsafe-url

        For more information about these values, see Referrer-Policy in the MDN Web Docs.

    • ContentSecurityPolicy (dict) --

      The policy directives and their values that CloudFront includes as values for the Content-Security-Policy HTTP response header.

      For more information about the Content-Security-Policy HTTP response header, see Content-Security-Policy in the MDN Web Docs.

      • Override (boolean) -- [REQUIRED]

        A Boolean that determines whether CloudFront overrides the Content-Security-Policy HTTP response header received from the origin with the one specified in this response headers policy.

      • ContentSecurityPolicy (string) -- [REQUIRED]

        The policy directives and their values that CloudFront includes as values for the Content-Security-Policy HTTP response header.

    • ContentTypeOptions (dict) --

      Determines whether CloudFront includes the X-Content-Type-Options HTTP response header with its value set to nosniff .

      For more information about the X-Content-Type-Options HTTP response header, see X-Content-Type-Options in the MDN Web Docs.

      • Override (boolean) -- [REQUIRED]

        A Boolean that determines whether CloudFront overrides the X-Content-Type-Options HTTP response header received from the origin with the one specified in this response headers policy.

    • StrictTransportSecurity (dict) --

      Determines whether CloudFront includes the Strict-Transport-Security HTTP response header and the header's value.

      For more information about the Strict-Transport-Security HTTP response header, see Strict-Transport-Security in the MDN Web Docs.

      • Override (boolean) -- [REQUIRED]

        A Boolean that determines whether CloudFront overrides the Strict-Transport-Security HTTP response header received from the origin with the one specified in this response headers policy.

      • IncludeSubdomains (boolean) --

        A Boolean that determines whether CloudFront includes the includeSubDomains directive in the Strict-Transport-Security HTTP response header.

      • Preload (boolean) --

        A Boolean that determines whether CloudFront includes the preload directive in the Strict-Transport-Security HTTP response header.

      • AccessControlMaxAgeSec (integer) -- [REQUIRED]

        A number that CloudFront uses as the value for the max-age directive in the Strict-Transport-Security HTTP response header.

  • ServerTimingHeadersConfig (dict) --

    A configuration for enabling the Server-Timing header in HTTP responses sent from CloudFront.

    • Enabled (boolean) -- [REQUIRED]

      A Boolean that determines whether CloudFront adds the Server-Timing header to HTTP responses that it sends in response to requests that match a cache behavior that's associated with this response headers policy.

    • SamplingRate (float) --

      A number 0–100 (inclusive) that specifies the percentage of responses that you want CloudFront to add the Server-Timing header to. When you set the sampling rate to 100, CloudFront adds the Server-Timing header to the HTTP response for every request that matches the cache behavior that this response headers policy is attached to. When you set it to 50, CloudFront adds the header to 50% of the responses for requests that match the cache behavior. You can set the sampling rate to any number 0–100 with up to four decimal places.

  • CustomHeadersConfig (dict) --

    A configuration for a set of custom HTTP response headers.

    • Quantity (integer) -- [REQUIRED]

      The number of HTTP response headers in the list.

    • Items (list) --

      The list of HTTP response headers and their values.

      • (dict) --

        An HTTP response header name and its value. CloudFront includes this header in HTTP responses that it sends for requests that match a cache behavior that's associated with this response headers policy.

        • Header (string) -- [REQUIRED]

          The HTTP response header name.

        • Value (string) -- [REQUIRED]

          The value for the HTTP response header.

        • Override (boolean) -- [REQUIRED]

          A Boolean that determines whether CloudFront overrides a response header with the same name received from the origin with the header specified here.

  • RemoveHeadersConfig (dict) --

    A configuration for a set of HTTP headers to remove from the HTTP response.

    • Quantity (integer) -- [REQUIRED]

      The number of HTTP header names in the list.

    • Items (list) --

      The list of HTTP header names.

      • (dict) --

        The name of an HTTP header that CloudFront removes from HTTP responses to requests that match the cache behavior that this response headers policy is attached to.

        • Header (string) -- [REQUIRED]

          The HTTP header name.

rtype

dict

returns

Response Syntax

{
    'ResponseHeadersPolicy': {
        'Id': 'string',
        'LastModifiedTime': datetime(2015, 1, 1),
        'ResponseHeadersPolicyConfig': {
            'Comment': 'string',
            'Name': 'string',
            'CorsConfig': {
                'AccessControlAllowOrigins': {
                    'Quantity': 123,
                    'Items': [
                        'string',
                    ]
                },
                'AccessControlAllowHeaders': {
                    'Quantity': 123,
                    'Items': [
                        'string',
                    ]
                },
                'AccessControlAllowMethods': {
                    'Quantity': 123,
                    'Items': [
                        'GET'|'POST'|'OPTIONS'|'PUT'|'DELETE'|'PATCH'|'HEAD'|'ALL',
                    ]
                },
                'AccessControlAllowCredentials': True|False,
                'AccessControlExposeHeaders': {
                    'Quantity': 123,
                    'Items': [
                        'string',
                    ]
                },
                'AccessControlMaxAgeSec': 123,
                'OriginOverride': True|False
            },
            'SecurityHeadersConfig': {
                'XSSProtection': {
                    'Override': True|False,
                    'Protection': True|False,
                    'ModeBlock': True|False,
                    'ReportUri': 'string'
                },
                'FrameOptions': {
                    'Override': True|False,
                    'FrameOption': 'DENY'|'SAMEORIGIN'
                },
                'ReferrerPolicy': {
                    'Override': True|False,
                    'ReferrerPolicy': 'no-referrer'|'no-referrer-when-downgrade'|'origin'|'origin-when-cross-origin'|'same-origin'|'strict-origin'|'strict-origin-when-cross-origin'|'unsafe-url'
                },
                'ContentSecurityPolicy': {
                    'Override': True|False,
                    'ContentSecurityPolicy': 'string'
                },
                'ContentTypeOptions': {
                    'Override': True|False
                },
                'StrictTransportSecurity': {
                    'Override': True|False,
                    'IncludeSubdomains': True|False,
                    'Preload': True|False,
                    'AccessControlMaxAgeSec': 123
                }
            },
            'ServerTimingHeadersConfig': {
                'Enabled': True|False,
                'SamplingRate': 123.0
            },
            'CustomHeadersConfig': {
                'Quantity': 123,
                'Items': [
                    {
                        'Header': 'string',
                        'Value': 'string',
                        'Override': True|False
                    },
                ]
            },
            'RemoveHeadersConfig': {
                'Quantity': 123,
                'Items': [
                    {
                        'Header': 'string'
                    },
                ]
            }
        }
    },
    'Location': 'string',
    'ETag': 'string'
}

Response Structure

  • (dict) --

    • ResponseHeadersPolicy (dict) --

      Contains a response headers policy.

      • Id (string) --

        The identifier for the response headers policy.

      • LastModifiedTime (datetime) --

        The date and time when the response headers policy was last modified.

      • ResponseHeadersPolicyConfig (dict) --

        A response headers policy configuration.

        • Comment (string) --

          A comment to describe the response headers policy.

          The comment cannot be longer than 128 characters.

        • Name (string) --

          A name to identify the response headers policy.

          The name must be unique for response headers policies in this Amazon Web Services account.

        • CorsConfig (dict) --

          A configuration for a set of HTTP response headers that are used for cross-origin resource sharing (CORS).

          • AccessControlAllowOrigins (dict) --

            A list of origins (domain names) that CloudFront can use as the value for the Access-Control-Allow-Origin HTTP response header.

            For more information about the Access-Control-Allow-Origin HTTP response header, see Access-Control-Allow-Origin in the MDN Web Docs.

            • Quantity (integer) --

              The number of origins in the list.

            • Items (list) --

              The list of origins (domain names). You can specify * to allow all origins.

              • (string) --

          • AccessControlAllowHeaders (dict) --

            A list of HTTP header names that CloudFront includes as values for the Access-Control-Allow-Headers HTTP response header.

            For more information about the Access-Control-Allow-Headers HTTP response header, see Access-Control-Allow-Headers in the MDN Web Docs.

            • Quantity (integer) --

              The number of HTTP header names in the list.

            • Items (list) --

              The list of HTTP header names. You can specify * to allow all headers.

              • (string) --

          • AccessControlAllowMethods (dict) --

            A list of HTTP methods that CloudFront includes as values for the Access-Control-Allow-Methods HTTP response header.

            For more information about the Access-Control-Allow-Methods HTTP response header, see Access-Control-Allow-Methods in the MDN Web Docs.

            • Quantity (integer) --

              The number of HTTP methods in the list.

            • Items (list) --

              The list of HTTP methods. Valid values are:

              • GET

              • DELETE

              • HEAD

              • OPTIONS

              • PATCH

              • POST

              • PUT

              • ALL

              ALL is a special value that includes all of the listed HTTP methods.

              • (string) --

          • AccessControlAllowCredentials (boolean) --

            A Boolean that CloudFront uses as the value for the Access-Control-Allow-Credentials HTTP response header.

            For more information about the Access-Control-Allow-Credentials HTTP response header, see Access-Control-Allow-Credentials in the MDN Web Docs.

          • AccessControlExposeHeaders (dict) --

            A list of HTTP headers that CloudFront includes as values for the Access-Control-Expose-Headers HTTP response header.

            For more information about the Access-Control-Expose-Headers HTTP response header, see Access-Control-Expose-Headers in the MDN Web Docs.

            • Quantity (integer) --

              The number of HTTP headers in the list.

            • Items (list) --

              The list of HTTP headers. You can specify * to expose all headers.

              • (string) --

          • AccessControlMaxAgeSec (integer) --

            A number that CloudFront uses as the value for the Access-Control-Max-Age HTTP response header.

            For more information about the Access-Control-Max-Age HTTP response header, see Access-Control-Max-Age in the MDN Web Docs.

          • OriginOverride (boolean) --

            A Boolean that determines whether CloudFront overrides HTTP response headers received from the origin with the ones specified in this response headers policy.

        • SecurityHeadersConfig (dict) --

          A configuration for a set of security-related HTTP response headers.

          • XSSProtection (dict) --

            Determines whether CloudFront includes the X-XSS-Protection HTTP response header and the header's value.

            For more information about the X-XSS-Protection HTTP response header, see X-XSS-Protection in the MDN Web Docs.

            • Override (boolean) --

              A Boolean that determines whether CloudFront overrides the X-XSS-Protection HTTP response header received from the origin with the one specified in this response headers policy.

            • Protection (boolean) --

              A Boolean that determines the value of the X-XSS-Protection HTTP response header. When this setting is true , the value of the X-XSS-Protection header is 1 . When this setting is false , the value of the X-XSS-Protection header is 0 .

              For more information about these settings, see X-XSS-Protection in the MDN Web Docs.

            • ModeBlock (boolean) --

              A Boolean that determines whether CloudFront includes the mode=block directive in the X-XSS-Protection header.

              For more information about this directive, see X-XSS-Protection in the MDN Web Docs.

            • ReportUri (string) --

              A reporting URI, which CloudFront uses as the value of the report directive in the X-XSS-Protection header.

              You cannot specify a ReportUri when ModeBlock is true .

              For more information about using a reporting URL, see X-XSS-Protection in the MDN Web Docs.

          • FrameOptions (dict) --

            Determines whether CloudFront includes the X-Frame-Options HTTP response header and the header's value.

            For more information about the X-Frame-Options HTTP response header, see X-Frame-Options in the MDN Web Docs.

            • Override (boolean) --

              A Boolean that determines whether CloudFront overrides the X-Frame-Options HTTP response header received from the origin with the one specified in this response headers policy.

            • FrameOption (string) --

              The value of the X-Frame-Options HTTP response header. Valid values are DENY and SAMEORIGIN .

              For more information about these values, see X-Frame-Options in the MDN Web Docs.

          • ReferrerPolicy (dict) --

            Determines whether CloudFront includes the Referrer-Policy HTTP response header and the header's value.

            For more information about the Referrer-Policy HTTP response header, see Referrer-Policy in the MDN Web Docs.

            • Override (boolean) --

              A Boolean that determines whether CloudFront overrides the Referrer-Policy HTTP response header received from the origin with the one specified in this response headers policy.

            • ReferrerPolicy (string) --

              The value of the Referrer-Policy HTTP response header. Valid values are:

              • no-referrer

              • no-referrer-when-downgrade

              • origin

              • origin-when-cross-origin

              • same-origin

              • strict-origin

              • strict-origin-when-cross-origin

              • unsafe-url

              For more information about these values, see Referrer-Policy in the MDN Web Docs.

          • ContentSecurityPolicy (dict) --

            The policy directives and their values that CloudFront includes as values for the Content-Security-Policy HTTP response header.

            For more information about the Content-Security-Policy HTTP response header, see Content-Security-Policy in the MDN Web Docs.

            • Override (boolean) --

              A Boolean that determines whether CloudFront overrides the Content-Security-Policy HTTP response header received from the origin with the one specified in this response headers policy.

            • ContentSecurityPolicy (string) --

              The policy directives and their values that CloudFront includes as values for the Content-Security-Policy HTTP response header.

          • ContentTypeOptions (dict) --

            Determines whether CloudFront includes the X-Content-Type-Options HTTP response header with its value set to nosniff .

            For more information about the X-Content-Type-Options HTTP response header, see X-Content-Type-Options in the MDN Web Docs.

            • Override (boolean) --

              A Boolean that determines whether CloudFront overrides the X-Content-Type-Options HTTP response header received from the origin with the one specified in this response headers policy.

          • StrictTransportSecurity (dict) --

            Determines whether CloudFront includes the Strict-Transport-Security HTTP response header and the header's value.

            For more information about the Strict-Transport-Security HTTP response header, see Strict-Transport-Security in the MDN Web Docs.

            • Override (boolean) --

              A Boolean that determines whether CloudFront overrides the Strict-Transport-Security HTTP response header received from the origin with the one specified in this response headers policy.

            • IncludeSubdomains (boolean) --

              A Boolean that determines whether CloudFront includes the includeSubDomains directive in the Strict-Transport-Security HTTP response header.

            • Preload (boolean) --

              A Boolean that determines whether CloudFront includes the preload directive in the Strict-Transport-Security HTTP response header.

            • AccessControlMaxAgeSec (integer) --

              A number that CloudFront uses as the value for the max-age directive in the Strict-Transport-Security HTTP response header.

        • ServerTimingHeadersConfig (dict) --

          A configuration for enabling the Server-Timing header in HTTP responses sent from CloudFront.

          • Enabled (boolean) --

            A Boolean that determines whether CloudFront adds the Server-Timing header to HTTP responses that it sends in response to requests that match a cache behavior that's associated with this response headers policy.

          • SamplingRate (float) --

            A number 0–100 (inclusive) that specifies the percentage of responses that you want CloudFront to add the Server-Timing header to. When you set the sampling rate to 100, CloudFront adds the Server-Timing header to the HTTP response for every request that matches the cache behavior that this response headers policy is attached to. When you set it to 50, CloudFront adds the header to 50% of the responses for requests that match the cache behavior. You can set the sampling rate to any number 0–100 with up to four decimal places.

        • CustomHeadersConfig (dict) --

          A configuration for a set of custom HTTP response headers.

          • Quantity (integer) --

            The number of HTTP response headers in the list.

          • Items (list) --

            The list of HTTP response headers and their values.

            • (dict) --

              An HTTP response header name and its value. CloudFront includes this header in HTTP responses that it sends for requests that match a cache behavior that's associated with this response headers policy.

              • Header (string) --

                The HTTP response header name.

              • Value (string) --

                The value for the HTTP response header.

              • Override (boolean) --

                A Boolean that determines whether CloudFront overrides a response header with the same name received from the origin with the header specified here.

        • RemoveHeadersConfig (dict) --

          A configuration for a set of HTTP headers to remove from the HTTP response.

          • Quantity (integer) --

            The number of HTTP header names in the list.

          • Items (list) --

            The list of HTTP header names.

            • (dict) --

              The name of an HTTP header that CloudFront removes from HTTP responses to requests that match the cache behavior that this response headers policy is attached to.

              • Header (string) --

                The HTTP header name.

    • Location (string) --

      The URL of the response headers policy.

    • ETag (string) --

      The version identifier for the current version of the response headers policy.

GetResponseHeadersPolicy (updated) Link ¶
Changes (response)
{'ResponseHeadersPolicy': {'ResponseHeadersPolicyConfig': {'RemoveHeadersConfig': {'Items': [{'Header': 'string'}],
                                                                                   'Quantity': 'integer'}}}}

Gets a response headers policy, including metadata (the policy's identifier and the date and time when the policy was last modified).

To get a response headers policy, you must provide the policy's identifier. If the response headers policy is attached to a distribution's cache behavior, you can get the policy's identifier using ListDistributions or GetDistribution . If the response headers policy is not attached to a cache behavior, you can get the identifier using ListResponseHeadersPolicies .

See also: AWS API Documentation

Request Syntax

client.get_response_headers_policy(
    Id='string'
)
type Id

string

param Id

[REQUIRED]

The identifier for the response headers policy.

If the response headers policy is attached to a distribution's cache behavior, you can get the policy's identifier using ListDistributions or GetDistribution . If the response headers policy is not attached to a cache behavior, you can get the identifier using ListResponseHeadersPolicies .

rtype

dict

returns

Response Syntax

{
    'ResponseHeadersPolicy': {
        'Id': 'string',
        'LastModifiedTime': datetime(2015, 1, 1),
        'ResponseHeadersPolicyConfig': {
            'Comment': 'string',
            'Name': 'string',
            'CorsConfig': {
                'AccessControlAllowOrigins': {
                    'Quantity': 123,
                    'Items': [
                        'string',
                    ]
                },
                'AccessControlAllowHeaders': {
                    'Quantity': 123,
                    'Items': [
                        'string',
                    ]
                },
                'AccessControlAllowMethods': {
                    'Quantity': 123,
                    'Items': [
                        'GET'|'POST'|'OPTIONS'|'PUT'|'DELETE'|'PATCH'|'HEAD'|'ALL',
                    ]
                },
                'AccessControlAllowCredentials': True|False,
                'AccessControlExposeHeaders': {
                    'Quantity': 123,
                    'Items': [
                        'string',
                    ]
                },
                'AccessControlMaxAgeSec': 123,
                'OriginOverride': True|False
            },
            'SecurityHeadersConfig': {
                'XSSProtection': {
                    'Override': True|False,
                    'Protection': True|False,
                    'ModeBlock': True|False,
                    'ReportUri': 'string'
                },
                'FrameOptions': {
                    'Override': True|False,
                    'FrameOption': 'DENY'|'SAMEORIGIN'
                },
                'ReferrerPolicy': {
                    'Override': True|False,
                    'ReferrerPolicy': 'no-referrer'|'no-referrer-when-downgrade'|'origin'|'origin-when-cross-origin'|'same-origin'|'strict-origin'|'strict-origin-when-cross-origin'|'unsafe-url'
                },
                'ContentSecurityPolicy': {
                    'Override': True|False,
                    'ContentSecurityPolicy': 'string'
                },
                'ContentTypeOptions': {
                    'Override': True|False
                },
                'StrictTransportSecurity': {
                    'Override': True|False,
                    'IncludeSubdomains': True|False,
                    'Preload': True|False,
                    'AccessControlMaxAgeSec': 123
                }
            },
            'ServerTimingHeadersConfig': {
                'Enabled': True|False,
                'SamplingRate': 123.0
            },
            'CustomHeadersConfig': {
                'Quantity': 123,
                'Items': [
                    {
                        'Header': 'string',
                        'Value': 'string',
                        'Override': True|False
                    },
                ]
            },
            'RemoveHeadersConfig': {
                'Quantity': 123,
                'Items': [
                    {
                        'Header': 'string'
                    },
                ]
            }
        }
    },
    'ETag': 'string'
}

Response Structure

  • (dict) --

    • ResponseHeadersPolicy (dict) --

      Contains a response headers policy.

      • Id (string) --

        The identifier for the response headers policy.

      • LastModifiedTime (datetime) --

        The date and time when the response headers policy was last modified.

      • ResponseHeadersPolicyConfig (dict) --

        A response headers policy configuration.

        • Comment (string) --

          A comment to describe the response headers policy.

          The comment cannot be longer than 128 characters.

        • Name (string) --

          A name to identify the response headers policy.

          The name must be unique for response headers policies in this Amazon Web Services account.

        • CorsConfig (dict) --

          A configuration for a set of HTTP response headers that are used for cross-origin resource sharing (CORS).

          • AccessControlAllowOrigins (dict) --

            A list of origins (domain names) that CloudFront can use as the value for the Access-Control-Allow-Origin HTTP response header.

            For more information about the Access-Control-Allow-Origin HTTP response header, see Access-Control-Allow-Origin in the MDN Web Docs.

            • Quantity (integer) --

              The number of origins in the list.

            • Items (list) --

              The list of origins (domain names). You can specify * to allow all origins.

              • (string) --

          • AccessControlAllowHeaders (dict) --

            A list of HTTP header names that CloudFront includes as values for the Access-Control-Allow-Headers HTTP response header.

            For more information about the Access-Control-Allow-Headers HTTP response header, see Access-Control-Allow-Headers in the MDN Web Docs.

            • Quantity (integer) --

              The number of HTTP header names in the list.

            • Items (list) --

              The list of HTTP header names. You can specify * to allow all headers.

              • (string) --

          • AccessControlAllowMethods (dict) --

            A list of HTTP methods that CloudFront includes as values for the Access-Control-Allow-Methods HTTP response header.

            For more information about the Access-Control-Allow-Methods HTTP response header, see Access-Control-Allow-Methods in the MDN Web Docs.

            • Quantity (integer) --

              The number of HTTP methods in the list.

            • Items (list) --

              The list of HTTP methods. Valid values are:

              • GET

              • DELETE

              • HEAD

              • OPTIONS

              • PATCH

              • POST

              • PUT

              • ALL

              ALL is a special value that includes all of the listed HTTP methods.

              • (string) --

          • AccessControlAllowCredentials (boolean) --

            A Boolean that CloudFront uses as the value for the Access-Control-Allow-Credentials HTTP response header.

            For more information about the Access-Control-Allow-Credentials HTTP response header, see Access-Control-Allow-Credentials in the MDN Web Docs.

          • AccessControlExposeHeaders (dict) --

            A list of HTTP headers that CloudFront includes as values for the Access-Control-Expose-Headers HTTP response header.

            For more information about the Access-Control-Expose-Headers HTTP response header, see Access-Control-Expose-Headers in the MDN Web Docs.

            • Quantity (integer) --

              The number of HTTP headers in the list.

            • Items (list) --

              The list of HTTP headers. You can specify * to expose all headers.

              • (string) --

          • AccessControlMaxAgeSec (integer) --

            A number that CloudFront uses as the value for the Access-Control-Max-Age HTTP response header.

            For more information about the Access-Control-Max-Age HTTP response header, see Access-Control-Max-Age in the MDN Web Docs.

          • OriginOverride (boolean) --

            A Boolean that determines whether CloudFront overrides HTTP response headers received from the origin with the ones specified in this response headers policy.

        • SecurityHeadersConfig (dict) --

          A configuration for a set of security-related HTTP response headers.

          • XSSProtection (dict) --

            Determines whether CloudFront includes the X-XSS-Protection HTTP response header and the header's value.

            For more information about the X-XSS-Protection HTTP response header, see X-XSS-Protection in the MDN Web Docs.

            • Override (boolean) --

              A Boolean that determines whether CloudFront overrides the X-XSS-Protection HTTP response header received from the origin with the one specified in this response headers policy.

            • Protection (boolean) --

              A Boolean that determines the value of the X-XSS-Protection HTTP response header. When this setting is true , the value of the X-XSS-Protection header is 1 . When this setting is false , the value of the X-XSS-Protection header is 0 .

              For more information about these settings, see X-XSS-Protection in the MDN Web Docs.

            • ModeBlock (boolean) --

              A Boolean that determines whether CloudFront includes the mode=block directive in the X-XSS-Protection header.

              For more information about this directive, see X-XSS-Protection in the MDN Web Docs.

            • ReportUri (string) --

              A reporting URI, which CloudFront uses as the value of the report directive in the X-XSS-Protection header.

              You cannot specify a ReportUri when ModeBlock is true .

              For more information about using a reporting URL, see X-XSS-Protection in the MDN Web Docs.

          • FrameOptions (dict) --

            Determines whether CloudFront includes the X-Frame-Options HTTP response header and the header's value.

            For more information about the X-Frame-Options HTTP response header, see X-Frame-Options in the MDN Web Docs.

            • Override (boolean) --

              A Boolean that determines whether CloudFront overrides the X-Frame-Options HTTP response header received from the origin with the one specified in this response headers policy.

            • FrameOption (string) --

              The value of the X-Frame-Options HTTP response header. Valid values are DENY and SAMEORIGIN .

              For more information about these values, see X-Frame-Options in the MDN Web Docs.

          • ReferrerPolicy (dict) --

            Determines whether CloudFront includes the Referrer-Policy HTTP response header and the header's value.

            For more information about the Referrer-Policy HTTP response header, see Referrer-Policy in the MDN Web Docs.

            • Override (boolean) --

              A Boolean that determines whether CloudFront overrides the Referrer-Policy HTTP response header received from the origin with the one specified in this response headers policy.

            • ReferrerPolicy (string) --

              The value of the Referrer-Policy HTTP response header. Valid values are:

              • no-referrer

              • no-referrer-when-downgrade

              • origin

              • origin-when-cross-origin

              • same-origin

              • strict-origin

              • strict-origin-when-cross-origin

              • unsafe-url

              For more information about these values, see Referrer-Policy in the MDN Web Docs.

          • ContentSecurityPolicy (dict) --

            The policy directives and their values that CloudFront includes as values for the Content-Security-Policy HTTP response header.

            For more information about the Content-Security-Policy HTTP response header, see Content-Security-Policy in the MDN Web Docs.

            • Override (boolean) --

              A Boolean that determines whether CloudFront overrides the Content-Security-Policy HTTP response header received from the origin with the one specified in this response headers policy.

            • ContentSecurityPolicy (string) --

              The policy directives and their values that CloudFront includes as values for the Content-Security-Policy HTTP response header.

          • ContentTypeOptions (dict) --

            Determines whether CloudFront includes the X-Content-Type-Options HTTP response header with its value set to nosniff .

            For more information about the X-Content-Type-Options HTTP response header, see X-Content-Type-Options in the MDN Web Docs.

            • Override (boolean) --

              A Boolean that determines whether CloudFront overrides the X-Content-Type-Options HTTP response header received from the origin with the one specified in this response headers policy.

          • StrictTransportSecurity (dict) --

            Determines whether CloudFront includes the Strict-Transport-Security HTTP response header and the header's value.

            For more information about the Strict-Transport-Security HTTP response header, see Strict-Transport-Security in the MDN Web Docs.

            • Override (boolean) --

              A Boolean that determines whether CloudFront overrides the Strict-Transport-Security HTTP response header received from the origin with the one specified in this response headers policy.

            • IncludeSubdomains (boolean) --

              A Boolean that determines whether CloudFront includes the includeSubDomains directive in the Strict-Transport-Security HTTP response header.

            • Preload (boolean) --

              A Boolean that determines whether CloudFront includes the preload directive in the Strict-Transport-Security HTTP response header.

            • AccessControlMaxAgeSec (integer) --

              A number that CloudFront uses as the value for the max-age directive in the Strict-Transport-Security HTTP response header.

        • ServerTimingHeadersConfig (dict) --

          A configuration for enabling the Server-Timing header in HTTP responses sent from CloudFront.

          • Enabled (boolean) --

            A Boolean that determines whether CloudFront adds the Server-Timing header to HTTP responses that it sends in response to requests that match a cache behavior that's associated with this response headers policy.

          • SamplingRate (float) --

            A number 0–100 (inclusive) that specifies the percentage of responses that you want CloudFront to add the Server-Timing header to. When you set the sampling rate to 100, CloudFront adds the Server-Timing header to the HTTP response for every request that matches the cache behavior that this response headers policy is attached to. When you set it to 50, CloudFront adds the header to 50% of the responses for requests that match the cache behavior. You can set the sampling rate to any number 0–100 with up to four decimal places.

        • CustomHeadersConfig (dict) --

          A configuration for a set of custom HTTP response headers.

          • Quantity (integer) --

            The number of HTTP response headers in the list.

          • Items (list) --

            The list of HTTP response headers and their values.

            • (dict) --

              An HTTP response header name and its value. CloudFront includes this header in HTTP responses that it sends for requests that match a cache behavior that's associated with this response headers policy.

              • Header (string) --

                The HTTP response header name.

              • Value (string) --

                The value for the HTTP response header.

              • Override (boolean) --

                A Boolean that determines whether CloudFront overrides a response header with the same name received from the origin with the header specified here.

        • RemoveHeadersConfig (dict) --

          A configuration for a set of HTTP headers to remove from the HTTP response.

          • Quantity (integer) --

            The number of HTTP header names in the list.

          • Items (list) --

            The list of HTTP header names.

            • (dict) --

              The name of an HTTP header that CloudFront removes from HTTP responses to requests that match the cache behavior that this response headers policy is attached to.

              • Header (string) --

                The HTTP header name.

    • ETag (string) --

      The version identifier for the current version of the response headers policy.

GetResponseHeadersPolicyConfig (updated) Link ¶
Changes (response)
{'ResponseHeadersPolicyConfig': {'RemoveHeadersConfig': {'Items': [{'Header': 'string'}],
                                                         'Quantity': 'integer'}}}

Gets a response headers policy configuration.

To get a response headers policy configuration, you must provide the policy's identifier. If the response headers policy is attached to a distribution's cache behavior, you can get the policy's identifier using ListDistributions or GetDistribution . If the response headers policy is not attached to a cache behavior, you can get the identifier using ListResponseHeadersPolicies .

See also: AWS API Documentation

Request Syntax

client.get_response_headers_policy_config(
    Id='string'
)
type Id

string

param Id

[REQUIRED]

The identifier for the response headers policy.

If the response headers policy is attached to a distribution's cache behavior, you can get the policy's identifier using ListDistributions or GetDistribution . If the response headers policy is not attached to a cache behavior, you can get the identifier using ListResponseHeadersPolicies .

rtype

dict

returns

Response Syntax

{
    'ResponseHeadersPolicyConfig': {
        'Comment': 'string',
        'Name': 'string',
        'CorsConfig': {
            'AccessControlAllowOrigins': {
                'Quantity': 123,
                'Items': [
                    'string',
                ]
            },
            'AccessControlAllowHeaders': {
                'Quantity': 123,
                'Items': [
                    'string',
                ]
            },
            'AccessControlAllowMethods': {
                'Quantity': 123,
                'Items': [
                    'GET'|'POST'|'OPTIONS'|'PUT'|'DELETE'|'PATCH'|'HEAD'|'ALL',
                ]
            },
            'AccessControlAllowCredentials': True|False,
            'AccessControlExposeHeaders': {
                'Quantity': 123,
                'Items': [
                    'string',
                ]
            },
            'AccessControlMaxAgeSec': 123,
            'OriginOverride': True|False
        },
        'SecurityHeadersConfig': {
            'XSSProtection': {
                'Override': True|False,
                'Protection': True|False,
                'ModeBlock': True|False,
                'ReportUri': 'string'
            },
            'FrameOptions': {
                'Override': True|False,
                'FrameOption': 'DENY'|'SAMEORIGIN'
            },
            'ReferrerPolicy': {
                'Override': True|False,
                'ReferrerPolicy': 'no-referrer'|'no-referrer-when-downgrade'|'origin'|'origin-when-cross-origin'|'same-origin'|'strict-origin'|'strict-origin-when-cross-origin'|'unsafe-url'
            },
            'ContentSecurityPolicy': {
                'Override': True|False,
                'ContentSecurityPolicy': 'string'
            },
            'ContentTypeOptions': {
                'Override': True|False
            },
            'StrictTransportSecurity': {
                'Override': True|False,
                'IncludeSubdomains': True|False,
                'Preload': True|False,
                'AccessControlMaxAgeSec': 123
            }
        },
        'ServerTimingHeadersConfig': {
            'Enabled': True|False,
            'SamplingRate': 123.0
        },
        'CustomHeadersConfig': {
            'Quantity': 123,
            'Items': [
                {
                    'Header': 'string',
                    'Value': 'string',
                    'Override': True|False
                },
            ]
        },
        'RemoveHeadersConfig': {
            'Quantity': 123,
            'Items': [
                {
                    'Header': 'string'
                },
            ]
        }
    },
    'ETag': 'string'
}

Response Structure

  • (dict) --

    • ResponseHeadersPolicyConfig (dict) --

      Contains a response headers policy.

      • Comment (string) --

        A comment to describe the response headers policy.

        The comment cannot be longer than 128 characters.

      • Name (string) --

        A name to identify the response headers policy.

        The name must be unique for response headers policies in this Amazon Web Services account.

      • CorsConfig (dict) --

        A configuration for a set of HTTP response headers that are used for cross-origin resource sharing (CORS).

        • AccessControlAllowOrigins (dict) --

          A list of origins (domain names) that CloudFront can use as the value for the Access-Control-Allow-Origin HTTP response header.

          For more information about the Access-Control-Allow-Origin HTTP response header, see Access-Control-Allow-Origin in the MDN Web Docs.

          • Quantity (integer) --

            The number of origins in the list.

          • Items (list) --

            The list of origins (domain names). You can specify * to allow all origins.

            • (string) --

        • AccessControlAllowHeaders (dict) --

          A list of HTTP header names that CloudFront includes as values for the Access-Control-Allow-Headers HTTP response header.

          For more information about the Access-Control-Allow-Headers HTTP response header, see Access-Control-Allow-Headers in the MDN Web Docs.

          • Quantity (integer) --

            The number of HTTP header names in the list.

          • Items (list) --

            The list of HTTP header names. You can specify * to allow all headers.

            • (string) --

        • AccessControlAllowMethods (dict) --

          A list of HTTP methods that CloudFront includes as values for the Access-Control-Allow-Methods HTTP response header.

          For more information about the Access-Control-Allow-Methods HTTP response header, see Access-Control-Allow-Methods in the MDN Web Docs.

          • Quantity (integer) --

            The number of HTTP methods in the list.

          • Items (list) --

            The list of HTTP methods. Valid values are:

            • GET

            • DELETE

            • HEAD

            • OPTIONS

            • PATCH

            • POST

            • PUT

            • ALL

            ALL is a special value that includes all of the listed HTTP methods.

            • (string) --

        • AccessControlAllowCredentials (boolean) --

          A Boolean that CloudFront uses as the value for the Access-Control-Allow-Credentials HTTP response header.

          For more information about the Access-Control-Allow-Credentials HTTP response header, see Access-Control-Allow-Credentials in the MDN Web Docs.

        • AccessControlExposeHeaders (dict) --

          A list of HTTP headers that CloudFront includes as values for the Access-Control-Expose-Headers HTTP response header.

          For more information about the Access-Control-Expose-Headers HTTP response header, see Access-Control-Expose-Headers in the MDN Web Docs.

          • Quantity (integer) --

            The number of HTTP headers in the list.

          • Items (list) --

            The list of HTTP headers. You can specify * to expose all headers.

            • (string) --

        • AccessControlMaxAgeSec (integer) --

          A number that CloudFront uses as the value for the Access-Control-Max-Age HTTP response header.

          For more information about the Access-Control-Max-Age HTTP response header, see Access-Control-Max-Age in the MDN Web Docs.

        • OriginOverride (boolean) --

          A Boolean that determines whether CloudFront overrides HTTP response headers received from the origin with the ones specified in this response headers policy.

      • SecurityHeadersConfig (dict) --

        A configuration for a set of security-related HTTP response headers.

        • XSSProtection (dict) --

          Determines whether CloudFront includes the X-XSS-Protection HTTP response header and the header's value.

          For more information about the X-XSS-Protection HTTP response header, see X-XSS-Protection in the MDN Web Docs.

          • Override (boolean) --

            A Boolean that determines whether CloudFront overrides the X-XSS-Protection HTTP response header received from the origin with the one specified in this response headers policy.

          • Protection (boolean) --

            A Boolean that determines the value of the X-XSS-Protection HTTP response header. When this setting is true , the value of the X-XSS-Protection header is 1 . When this setting is false , the value of the X-XSS-Protection header is 0 .

            For more information about these settings, see X-XSS-Protection in the MDN Web Docs.

          • ModeBlock (boolean) --

            A Boolean that determines whether CloudFront includes the mode=block directive in the X-XSS-Protection header.

            For more information about this directive, see X-XSS-Protection in the MDN Web Docs.

          • ReportUri (string) --

            A reporting URI, which CloudFront uses as the value of the report directive in the X-XSS-Protection header.

            You cannot specify a ReportUri when ModeBlock is true .

            For more information about using a reporting URL, see X-XSS-Protection in the MDN Web Docs.

        • FrameOptions (dict) --

          Determines whether CloudFront includes the X-Frame-Options HTTP response header and the header's value.

          For more information about the X-Frame-Options HTTP response header, see X-Frame-Options in the MDN Web Docs.

          • Override (boolean) --

            A Boolean that determines whether CloudFront overrides the X-Frame-Options HTTP response header received from the origin with the one specified in this response headers policy.

          • FrameOption (string) --

            The value of the X-Frame-Options HTTP response header. Valid values are DENY and SAMEORIGIN .

            For more information about these values, see X-Frame-Options in the MDN Web Docs.

        • ReferrerPolicy (dict) --

          Determines whether CloudFront includes the Referrer-Policy HTTP response header and the header's value.

          For more information about the Referrer-Policy HTTP response header, see Referrer-Policy in the MDN Web Docs.

          • Override (boolean) --

            A Boolean that determines whether CloudFront overrides the Referrer-Policy HTTP response header received from the origin with the one specified in this response headers policy.

          • ReferrerPolicy (string) --

            The value of the Referrer-Policy HTTP response header. Valid values are:

            • no-referrer

            • no-referrer-when-downgrade

            • origin

            • origin-when-cross-origin

            • same-origin

            • strict-origin

            • strict-origin-when-cross-origin

            • unsafe-url

            For more information about these values, see Referrer-Policy in the MDN Web Docs.

        • ContentSecurityPolicy (dict) --

          The policy directives and their values that CloudFront includes as values for the Content-Security-Policy HTTP response header.

          For more information about the Content-Security-Policy HTTP response header, see Content-Security-Policy in the MDN Web Docs.

          • Override (boolean) --

            A Boolean that determines whether CloudFront overrides the Content-Security-Policy HTTP response header received from the origin with the one specified in this response headers policy.

          • ContentSecurityPolicy (string) --

            The policy directives and their values that CloudFront includes as values for the Content-Security-Policy HTTP response header.

        • ContentTypeOptions (dict) --

          Determines whether CloudFront includes the X-Content-Type-Options HTTP response header with its value set to nosniff .

          For more information about the X-Content-Type-Options HTTP response header, see X-Content-Type-Options in the MDN Web Docs.

          • Override (boolean) --

            A Boolean that determines whether CloudFront overrides the X-Content-Type-Options HTTP response header received from the origin with the one specified in this response headers policy.

        • StrictTransportSecurity (dict) --

          Determines whether CloudFront includes the Strict-Transport-Security HTTP response header and the header's value.

          For more information about the Strict-Transport-Security HTTP response header, see Strict-Transport-Security in the MDN Web Docs.

          • Override (boolean) --

            A Boolean that determines whether CloudFront overrides the Strict-Transport-Security HTTP response header received from the origin with the one specified in this response headers policy.

          • IncludeSubdomains (boolean) --

            A Boolean that determines whether CloudFront includes the includeSubDomains directive in the Strict-Transport-Security HTTP response header.

          • Preload (boolean) --

            A Boolean that determines whether CloudFront includes the preload directive in the Strict-Transport-Security HTTP response header.

          • AccessControlMaxAgeSec (integer) --

            A number that CloudFront uses as the value for the max-age directive in the Strict-Transport-Security HTTP response header.

      • ServerTimingHeadersConfig (dict) --

        A configuration for enabling the Server-Timing header in HTTP responses sent from CloudFront.

        • Enabled (boolean) --

          A Boolean that determines whether CloudFront adds the Server-Timing header to HTTP responses that it sends in response to requests that match a cache behavior that's associated with this response headers policy.

        • SamplingRate (float) --

          A number 0–100 (inclusive) that specifies the percentage of responses that you want CloudFront to add the Server-Timing header to. When you set the sampling rate to 100, CloudFront adds the Server-Timing header to the HTTP response for every request that matches the cache behavior that this response headers policy is attached to. When you set it to 50, CloudFront adds the header to 50% of the responses for requests that match the cache behavior. You can set the sampling rate to any number 0–100 with up to four decimal places.

      • CustomHeadersConfig (dict) --

        A configuration for a set of custom HTTP response headers.

        • Quantity (integer) --

          The number of HTTP response headers in the list.

        • Items (list) --

          The list of HTTP response headers and their values.

          • (dict) --

            An HTTP response header name and its value. CloudFront includes this header in HTTP responses that it sends for requests that match a cache behavior that's associated with this response headers policy.

            • Header (string) --

              The HTTP response header name.

            • Value (string) --

              The value for the HTTP response header.

            • Override (boolean) --

              A Boolean that determines whether CloudFront overrides a response header with the same name received from the origin with the header specified here.

      • RemoveHeadersConfig (dict) --

        A configuration for a set of HTTP headers to remove from the HTTP response.

        • Quantity (integer) --

          The number of HTTP header names in the list.

        • Items (list) --

          The list of HTTP header names.

          • (dict) --

            The name of an HTTP header that CloudFront removes from HTTP responses to requests that match the cache behavior that this response headers policy is attached to.

            • Header (string) --

              The HTTP header name.

    • ETag (string) --

      The version identifier for the current version of the response headers policy.

ListResponseHeadersPolicies (updated) Link ¶
Changes (response)
{'ResponseHeadersPolicyList': {'Items': {'ResponseHeadersPolicy': {'ResponseHeadersPolicyConfig': {'RemoveHeadersConfig': {'Items': [{'Header': 'string'}],
                                                                                                                           'Quantity': 'integer'}}}}}}

Gets a list of response headers policies.

You can optionally apply a filter to get only the managed policies created by Amazon Web Services, or only the custom policies created in your Amazon Web Services account.

You can optionally specify the maximum number of items to receive in the response. If the total number of items in the list exceeds the maximum that you specify, or the default maximum, the response is paginated. To get the next page of items, send a subsequent request that specifies the NextMarker value from the current response as the Marker value in the subsequent request.

See also: AWS API Documentation

Request Syntax

client.list_response_headers_policies(
    Type='managed'|'custom',
    Marker='string',
    MaxItems='string'
)
type Type

string

param Type

A filter to get only the specified kind of response headers policies. Valid values are:

  • managed – Gets only the managed policies created by Amazon Web Services.

  • custom – Gets only the custom policies created in your Amazon Web Services account.

type Marker

string

param Marker

Use this field when paginating results to indicate where to begin in your list of response headers policies. The response includes response headers policies in the list that occur after the marker. To get the next page of the list, set this field's value to the value of NextMarker from the current page's response.

type MaxItems

string

param MaxItems

The maximum number of response headers policies that you want to get in the response.

rtype

dict

returns

Response Syntax

{
    'ResponseHeadersPolicyList': {
        'NextMarker': 'string',
        'MaxItems': 123,
        'Quantity': 123,
        'Items': [
            {
                'Type': 'managed'|'custom',
                'ResponseHeadersPolicy': {
                    'Id': 'string',
                    'LastModifiedTime': datetime(2015, 1, 1),
                    'ResponseHeadersPolicyConfig': {
                        'Comment': 'string',
                        'Name': 'string',
                        'CorsConfig': {
                            'AccessControlAllowOrigins': {
                                'Quantity': 123,
                                'Items': [
                                    'string',
                                ]
                            },
                            'AccessControlAllowHeaders': {
                                'Quantity': 123,
                                'Items': [
                                    'string',
                                ]
                            },
                            'AccessControlAllowMethods': {
                                'Quantity': 123,
                                'Items': [
                                    'GET'|'POST'|'OPTIONS'|'PUT'|'DELETE'|'PATCH'|'HEAD'|'ALL',
                                ]
                            },
                            'AccessControlAllowCredentials': True|False,
                            'AccessControlExposeHeaders': {
                                'Quantity': 123,
                                'Items': [
                                    'string',
                                ]
                            },
                            'AccessControlMaxAgeSec': 123,
                            'OriginOverride': True|False
                        },
                        'SecurityHeadersConfig': {
                            'XSSProtection': {
                                'Override': True|False,
                                'Protection': True|False,
                                'ModeBlock': True|False,
                                'ReportUri': 'string'
                            },
                            'FrameOptions': {
                                'Override': True|False,
                                'FrameOption': 'DENY'|'SAMEORIGIN'
                            },
                            'ReferrerPolicy': {
                                'Override': True|False,
                                'ReferrerPolicy': 'no-referrer'|'no-referrer-when-downgrade'|'origin'|'origin-when-cross-origin'|'same-origin'|'strict-origin'|'strict-origin-when-cross-origin'|'unsafe-url'
                            },
                            'ContentSecurityPolicy': {
                                'Override': True|False,
                                'ContentSecurityPolicy': 'string'
                            },
                            'ContentTypeOptions': {
                                'Override': True|False
                            },
                            'StrictTransportSecurity': {
                                'Override': True|False,
                                'IncludeSubdomains': True|False,
                                'Preload': True|False,
                                'AccessControlMaxAgeSec': 123
                            }
                        },
                        'ServerTimingHeadersConfig': {
                            'Enabled': True|False,
                            'SamplingRate': 123.0
                        },
                        'CustomHeadersConfig': {
                            'Quantity': 123,
                            'Items': [
                                {
                                    'Header': 'string',
                                    'Value': 'string',
                                    'Override': True|False
                                },
                            ]
                        },
                        'RemoveHeadersConfig': {
                            'Quantity': 123,
                            'Items': [
                                {
                                    'Header': 'string'
                                },
                            ]
                        }
                    }
                }
            },
        ]
    }
}

Response Structure

  • (dict) --

    • ResponseHeadersPolicyList (dict) --

      A list of response headers policies.

      • NextMarker (string) --

        If there are more items in the list than are in this response, this element is present. It contains the value that you should use in the Marker field of a subsequent request to continue listing response headers policies where you left off.

      • MaxItems (integer) --

        The maximum number of response headers policies requested.

      • Quantity (integer) --

        The number of response headers policies returned.

      • Items (list) --

        The response headers policies in the list.

        • (dict) --

          Contains a response headers policy.

          • Type (string) --

            The type of response headers policy, either managed (created by Amazon Web Services) or custom (created in this Amazon Web Services account).

          • ResponseHeadersPolicy (dict) --

            The response headers policy.

            • Id (string) --

              The identifier for the response headers policy.

            • LastModifiedTime (datetime) --

              The date and time when the response headers policy was last modified.

            • ResponseHeadersPolicyConfig (dict) --

              A response headers policy configuration.

              • Comment (string) --

                A comment to describe the response headers policy.

                The comment cannot be longer than 128 characters.

              • Name (string) --

                A name to identify the response headers policy.

                The name must be unique for response headers policies in this Amazon Web Services account.

              • CorsConfig (dict) --

                A configuration for a set of HTTP response headers that are used for cross-origin resource sharing (CORS).

                • AccessControlAllowOrigins (dict) --

                  A list of origins (domain names) that CloudFront can use as the value for the Access-Control-Allow-Origin HTTP response header.

                  For more information about the Access-Control-Allow-Origin HTTP response header, see Access-Control-Allow-Origin in the MDN Web Docs.

                  • Quantity (integer) --

                    The number of origins in the list.

                  • Items (list) --

                    The list of origins (domain names). You can specify * to allow all origins.

                    • (string) --

                • AccessControlAllowHeaders (dict) --

                  A list of HTTP header names that CloudFront includes as values for the Access-Control-Allow-Headers HTTP response header.

                  For more information about the Access-Control-Allow-Headers HTTP response header, see Access-Control-Allow-Headers in the MDN Web Docs.

                  • Quantity (integer) --

                    The number of HTTP header names in the list.

                  • Items (list) --

                    The list of HTTP header names. You can specify * to allow all headers.

                    • (string) --

                • AccessControlAllowMethods (dict) --

                  A list of HTTP methods that CloudFront includes as values for the Access-Control-Allow-Methods HTTP response header.

                  For more information about the Access-Control-Allow-Methods HTTP response header, see Access-Control-Allow-Methods in the MDN Web Docs.

                  • Quantity (integer) --

                    The number of HTTP methods in the list.

                  • Items (list) --

                    The list of HTTP methods. Valid values are:

                    • GET

                    • DELETE

                    • HEAD

                    • OPTIONS

                    • PATCH

                    • POST

                    • PUT

                    • ALL

                    ALL is a special value that includes all of the listed HTTP methods.

                    • (string) --

                • AccessControlAllowCredentials (boolean) --

                  A Boolean that CloudFront uses as the value for the Access-Control-Allow-Credentials HTTP response header.

                  For more information about the Access-Control-Allow-Credentials HTTP response header, see Access-Control-Allow-Credentials in the MDN Web Docs.

                • AccessControlExposeHeaders (dict) --

                  A list of HTTP headers that CloudFront includes as values for the Access-Control-Expose-Headers HTTP response header.

                  For more information about the Access-Control-Expose-Headers HTTP response header, see Access-Control-Expose-Headers in the MDN Web Docs.

                  • Quantity (integer) --

                    The number of HTTP headers in the list.

                  • Items (list) --

                    The list of HTTP headers. You can specify * to expose all headers.

                    • (string) --

                • AccessControlMaxAgeSec (integer) --

                  A number that CloudFront uses as the value for the Access-Control-Max-Age HTTP response header.

                  For more information about the Access-Control-Max-Age HTTP response header, see Access-Control-Max-Age in the MDN Web Docs.

                • OriginOverride (boolean) --

                  A Boolean that determines whether CloudFront overrides HTTP response headers received from the origin with the ones specified in this response headers policy.

              • SecurityHeadersConfig (dict) --

                A configuration for a set of security-related HTTP response headers.

                • XSSProtection (dict) --

                  Determines whether CloudFront includes the X-XSS-Protection HTTP response header and the header's value.

                  For more information about the X-XSS-Protection HTTP response header, see X-XSS-Protection in the MDN Web Docs.

                  • Override (boolean) --

                    A Boolean that determines whether CloudFront overrides the X-XSS-Protection HTTP response header received from the origin with the one specified in this response headers policy.

                  • Protection (boolean) --

                    A Boolean that determines the value of the X-XSS-Protection HTTP response header. When this setting is true , the value of the X-XSS-Protection header is 1 . When this setting is false , the value of the X-XSS-Protection header is 0 .

                    For more information about these settings, see X-XSS-Protection in the MDN Web Docs.

                  • ModeBlock (boolean) --

                    A Boolean that determines whether CloudFront includes the mode=block directive in the X-XSS-Protection header.

                    For more information about this directive, see X-XSS-Protection in the MDN Web Docs.

                  • ReportUri (string) --

                    A reporting URI, which CloudFront uses as the value of the report directive in the X-XSS-Protection header.

                    You cannot specify a ReportUri when ModeBlock is true .

                    For more information about using a reporting URL, see X-XSS-Protection in the MDN Web Docs.

                • FrameOptions (dict) --

                  Determines whether CloudFront includes the X-Frame-Options HTTP response header and the header's value.

                  For more information about the X-Frame-Options HTTP response header, see X-Frame-Options in the MDN Web Docs.

                  • Override (boolean) --

                    A Boolean that determines whether CloudFront overrides the X-Frame-Options HTTP response header received from the origin with the one specified in this response headers policy.

                  • FrameOption (string) --

                    The value of the X-Frame-Options HTTP response header. Valid values are DENY and SAMEORIGIN .

                    For more information about these values, see X-Frame-Options in the MDN Web Docs.

                • ReferrerPolicy (dict) --

                  Determines whether CloudFront includes the Referrer-Policy HTTP response header and the header's value.

                  For more information about the Referrer-Policy HTTP response header, see Referrer-Policy in the MDN Web Docs.

                  • Override (boolean) --

                    A Boolean that determines whether CloudFront overrides the Referrer-Policy HTTP response header received from the origin with the one specified in this response headers policy.

                  • ReferrerPolicy (string) --

                    The value of the Referrer-Policy HTTP response header. Valid values are:

                    • no-referrer

                    • no-referrer-when-downgrade

                    • origin

                    • origin-when-cross-origin

                    • same-origin

                    • strict-origin

                    • strict-origin-when-cross-origin

                    • unsafe-url

                    For more information about these values, see Referrer-Policy in the MDN Web Docs.

                • ContentSecurityPolicy (dict) --

                  The policy directives and their values that CloudFront includes as values for the Content-Security-Policy HTTP response header.

                  For more information about the Content-Security-Policy HTTP response header, see Content-Security-Policy in the MDN Web Docs.

                  • Override (boolean) --

                    A Boolean that determines whether CloudFront overrides the Content-Security-Policy HTTP response header received from the origin with the one specified in this response headers policy.

                  • ContentSecurityPolicy (string) --

                    The policy directives and their values that CloudFront includes as values for the Content-Security-Policy HTTP response header.

                • ContentTypeOptions (dict) --

                  Determines whether CloudFront includes the X-Content-Type-Options HTTP response header with its value set to nosniff .

                  For more information about the X-Content-Type-Options HTTP response header, see X-Content-Type-Options in the MDN Web Docs.

                  • Override (boolean) --

                    A Boolean that determines whether CloudFront overrides the X-Content-Type-Options HTTP response header received from the origin with the one specified in this response headers policy.

                • StrictTransportSecurity (dict) --

                  Determines whether CloudFront includes the Strict-Transport-Security HTTP response header and the header's value.

                  For more information about the Strict-Transport-Security HTTP response header, see Strict-Transport-Security in the MDN Web Docs.

                  • Override (boolean) --

                    A Boolean that determines whether CloudFront overrides the Strict-Transport-Security HTTP response header received from the origin with the one specified in this response headers policy.

                  • IncludeSubdomains (boolean) --

                    A Boolean that determines whether CloudFront includes the includeSubDomains directive in the Strict-Transport-Security HTTP response header.

                  • Preload (boolean) --

                    A Boolean that determines whether CloudFront includes the preload directive in the Strict-Transport-Security HTTP response header.

                  • AccessControlMaxAgeSec (integer) --

                    A number that CloudFront uses as the value for the max-age directive in the Strict-Transport-Security HTTP response header.

              • ServerTimingHeadersConfig (dict) --

                A configuration for enabling the Server-Timing header in HTTP responses sent from CloudFront.

                • Enabled (boolean) --

                  A Boolean that determines whether CloudFront adds the Server-Timing header to HTTP responses that it sends in response to requests that match a cache behavior that's associated with this response headers policy.

                • SamplingRate (float) --

                  A number 0–100 (inclusive) that specifies the percentage of responses that you want CloudFront to add the Server-Timing header to. When you set the sampling rate to 100, CloudFront adds the Server-Timing header to the HTTP response for every request that matches the cache behavior that this response headers policy is attached to. When you set it to 50, CloudFront adds the header to 50% of the responses for requests that match the cache behavior. You can set the sampling rate to any number 0–100 with up to four decimal places.

              • CustomHeadersConfig (dict) --

                A configuration for a set of custom HTTP response headers.

                • Quantity (integer) --

                  The number of HTTP response headers in the list.

                • Items (list) --

                  The list of HTTP response headers and their values.

                  • (dict) --

                    An HTTP response header name and its value. CloudFront includes this header in HTTP responses that it sends for requests that match a cache behavior that's associated with this response headers policy.

                    • Header (string) --

                      The HTTP response header name.

                    • Value (string) --

                      The value for the HTTP response header.

                    • Override (boolean) --

                      A Boolean that determines whether CloudFront overrides a response header with the same name received from the origin with the header specified here.

              • RemoveHeadersConfig (dict) --

                A configuration for a set of HTTP headers to remove from the HTTP response.

                • Quantity (integer) --

                  The number of HTTP header names in the list.

                • Items (list) --

                  The list of HTTP header names.

                  • (dict) --

                    The name of an HTTP header that CloudFront removes from HTTP responses to requests that match the cache behavior that this response headers policy is attached to.

                    • Header (string) --

                      The HTTP header name.

UpdateResponseHeadersPolicy (updated) Link ¶
Changes (request, response)
Request
{'ResponseHeadersPolicyConfig': {'RemoveHeadersConfig': {'Items': [{'Header': 'string'}],
                                                         'Quantity': 'integer'}}}
Response
{'ResponseHeadersPolicy': {'ResponseHeadersPolicyConfig': {'RemoveHeadersConfig': {'Items': [{'Header': 'string'}],
                                                                                   'Quantity': 'integer'}}}}

Updates a response headers policy.

When you update a response headers policy, the entire policy is replaced. You cannot update some policy fields independent of others. To update a response headers policy configuration:

  • Use GetResponseHeadersPolicyConfig to get the current policy's configuration.

  • Modify the fields in the response headers policy configuration that you want to update.

  • Call UpdateResponseHeadersPolicy , providing the entire response headers policy configuration, including the fields that you modified and those that you didn't.

See also: AWS API Documentation

Request Syntax

client.update_response_headers_policy(
    ResponseHeadersPolicyConfig={
        'Comment': 'string',
        'Name': 'string',
        'CorsConfig': {
            'AccessControlAllowOrigins': {
                'Quantity': 123,
                'Items': [
                    'string',
                ]
            },
            'AccessControlAllowHeaders': {
                'Quantity': 123,
                'Items': [
                    'string',
                ]
            },
            'AccessControlAllowMethods': {
                'Quantity': 123,
                'Items': [
                    'GET'|'POST'|'OPTIONS'|'PUT'|'DELETE'|'PATCH'|'HEAD'|'ALL',
                ]
            },
            'AccessControlAllowCredentials': True|False,
            'AccessControlExposeHeaders': {
                'Quantity': 123,
                'Items': [
                    'string',
                ]
            },
            'AccessControlMaxAgeSec': 123,
            'OriginOverride': True|False
        },
        'SecurityHeadersConfig': {
            'XSSProtection': {
                'Override': True|False,
                'Protection': True|False,
                'ModeBlock': True|False,
                'ReportUri': 'string'
            },
            'FrameOptions': {
                'Override': True|False,
                'FrameOption': 'DENY'|'SAMEORIGIN'
            },
            'ReferrerPolicy': {
                'Override': True|False,
                'ReferrerPolicy': 'no-referrer'|'no-referrer-when-downgrade'|'origin'|'origin-when-cross-origin'|'same-origin'|'strict-origin'|'strict-origin-when-cross-origin'|'unsafe-url'
            },
            'ContentSecurityPolicy': {
                'Override': True|False,
                'ContentSecurityPolicy': 'string'
            },
            'ContentTypeOptions': {
                'Override': True|False
            },
            'StrictTransportSecurity': {
                'Override': True|False,
                'IncludeSubdomains': True|False,
                'Preload': True|False,
                'AccessControlMaxAgeSec': 123
            }
        },
        'ServerTimingHeadersConfig': {
            'Enabled': True|False,
            'SamplingRate': 123.0
        },
        'CustomHeadersConfig': {
            'Quantity': 123,
            'Items': [
                {
                    'Header': 'string',
                    'Value': 'string',
                    'Override': True|False
                },
            ]
        },
        'RemoveHeadersConfig': {
            'Quantity': 123,
            'Items': [
                {
                    'Header': 'string'
                },
            ]
        }
    },
    Id='string',
    IfMatch='string'
)
type ResponseHeadersPolicyConfig

dict

param ResponseHeadersPolicyConfig

[REQUIRED]

A response headers policy configuration.

  • Comment (string) --

    A comment to describe the response headers policy.

    The comment cannot be longer than 128 characters.

  • Name (string) -- [REQUIRED]

    A name to identify the response headers policy.

    The name must be unique for response headers policies in this Amazon Web Services account.

  • CorsConfig (dict) --

    A configuration for a set of HTTP response headers that are used for cross-origin resource sharing (CORS).

    • AccessControlAllowOrigins (dict) -- [REQUIRED]

      A list of origins (domain names) that CloudFront can use as the value for the Access-Control-Allow-Origin HTTP response header.

      For more information about the Access-Control-Allow-Origin HTTP response header, see Access-Control-Allow-Origin in the MDN Web Docs.

      • Quantity (integer) -- [REQUIRED]

        The number of origins in the list.

      • Items (list) -- [REQUIRED]

        The list of origins (domain names). You can specify * to allow all origins.

        • (string) --

    • AccessControlAllowHeaders (dict) -- [REQUIRED]

      A list of HTTP header names that CloudFront includes as values for the Access-Control-Allow-Headers HTTP response header.

      For more information about the Access-Control-Allow-Headers HTTP response header, see Access-Control-Allow-Headers in the MDN Web Docs.

      • Quantity (integer) -- [REQUIRED]

        The number of HTTP header names in the list.

      • Items (list) -- [REQUIRED]

        The list of HTTP header names. You can specify * to allow all headers.

        • (string) --

    • AccessControlAllowMethods (dict) -- [REQUIRED]

      A list of HTTP methods that CloudFront includes as values for the Access-Control-Allow-Methods HTTP response header.

      For more information about the Access-Control-Allow-Methods HTTP response header, see Access-Control-Allow-Methods in the MDN Web Docs.

      • Quantity (integer) -- [REQUIRED]

        The number of HTTP methods in the list.

      • Items (list) -- [REQUIRED]

        The list of HTTP methods. Valid values are:

        • GET

        • DELETE

        • HEAD

        • OPTIONS

        • PATCH

        • POST

        • PUT

        • ALL

        ALL is a special value that includes all of the listed HTTP methods.

        • (string) --

    • AccessControlAllowCredentials (boolean) -- [REQUIRED]

      A Boolean that CloudFront uses as the value for the Access-Control-Allow-Credentials HTTP response header.

      For more information about the Access-Control-Allow-Credentials HTTP response header, see Access-Control-Allow-Credentials in the MDN Web Docs.

    • AccessControlExposeHeaders (dict) --

      A list of HTTP headers that CloudFront includes as values for the Access-Control-Expose-Headers HTTP response header.

      For more information about the Access-Control-Expose-Headers HTTP response header, see Access-Control-Expose-Headers in the MDN Web Docs.

      • Quantity (integer) -- [REQUIRED]

        The number of HTTP headers in the list.

      • Items (list) --

        The list of HTTP headers. You can specify * to expose all headers.

        • (string) --

    • AccessControlMaxAgeSec (integer) --

      A number that CloudFront uses as the value for the Access-Control-Max-Age HTTP response header.

      For more information about the Access-Control-Max-Age HTTP response header, see Access-Control-Max-Age in the MDN Web Docs.

    • OriginOverride (boolean) -- [REQUIRED]

      A Boolean that determines whether CloudFront overrides HTTP response headers received from the origin with the ones specified in this response headers policy.

  • SecurityHeadersConfig (dict) --

    A configuration for a set of security-related HTTP response headers.

    • XSSProtection (dict) --

      Determines whether CloudFront includes the X-XSS-Protection HTTP response header and the header's value.

      For more information about the X-XSS-Protection HTTP response header, see X-XSS-Protection in the MDN Web Docs.

      • Override (boolean) -- [REQUIRED]

        A Boolean that determines whether CloudFront overrides the X-XSS-Protection HTTP response header received from the origin with the one specified in this response headers policy.

      • Protection (boolean) -- [REQUIRED]

        A Boolean that determines the value of the X-XSS-Protection HTTP response header. When this setting is true , the value of the X-XSS-Protection header is 1 . When this setting is false , the value of the X-XSS-Protection header is 0 .

        For more information about these settings, see X-XSS-Protection in the MDN Web Docs.

      • ModeBlock (boolean) --

        A Boolean that determines whether CloudFront includes the mode=block directive in the X-XSS-Protection header.

        For more information about this directive, see X-XSS-Protection in the MDN Web Docs.

      • ReportUri (string) --

        A reporting URI, which CloudFront uses as the value of the report directive in the X-XSS-Protection header.

        You cannot specify a ReportUri when ModeBlock is true .

        For more information about using a reporting URL, see X-XSS-Protection in the MDN Web Docs.

    • FrameOptions (dict) --

      Determines whether CloudFront includes the X-Frame-Options HTTP response header and the header's value.

      For more information about the X-Frame-Options HTTP response header, see X-Frame-Options in the MDN Web Docs.

      • Override (boolean) -- [REQUIRED]

        A Boolean that determines whether CloudFront overrides the X-Frame-Options HTTP response header received from the origin with the one specified in this response headers policy.

      • FrameOption (string) -- [REQUIRED]

        The value of the X-Frame-Options HTTP response header. Valid values are DENY and SAMEORIGIN .

        For more information about these values, see X-Frame-Options in the MDN Web Docs.

    • ReferrerPolicy (dict) --

      Determines whether CloudFront includes the Referrer-Policy HTTP response header and the header's value.

      For more information about the Referrer-Policy HTTP response header, see Referrer-Policy in the MDN Web Docs.

      • Override (boolean) -- [REQUIRED]

        A Boolean that determines whether CloudFront overrides the Referrer-Policy HTTP response header received from the origin with the one specified in this response headers policy.

      • ReferrerPolicy (string) -- [REQUIRED]

        The value of the Referrer-Policy HTTP response header. Valid values are:

        • no-referrer

        • no-referrer-when-downgrade

        • origin

        • origin-when-cross-origin

        • same-origin

        • strict-origin

        • strict-origin-when-cross-origin

        • unsafe-url

        For more information about these values, see Referrer-Policy in the MDN Web Docs.

    • ContentSecurityPolicy (dict) --

      The policy directives and their values that CloudFront includes as values for the Content-Security-Policy HTTP response header.

      For more information about the Content-Security-Policy HTTP response header, see Content-Security-Policy in the MDN Web Docs.

      • Override (boolean) -- [REQUIRED]

        A Boolean that determines whether CloudFront overrides the Content-Security-Policy HTTP response header received from the origin with the one specified in this response headers policy.

      • ContentSecurityPolicy (string) -- [REQUIRED]

        The policy directives and their values that CloudFront includes as values for the Content-Security-Policy HTTP response header.

    • ContentTypeOptions (dict) --

      Determines whether CloudFront includes the X-Content-Type-Options HTTP response header with its value set to nosniff .

      For more information about the X-Content-Type-Options HTTP response header, see X-Content-Type-Options in the MDN Web Docs.

      • Override (boolean) -- [REQUIRED]

        A Boolean that determines whether CloudFront overrides the X-Content-Type-Options HTTP response header received from the origin with the one specified in this response headers policy.

    • StrictTransportSecurity (dict) --

      Determines whether CloudFront includes the Strict-Transport-Security HTTP response header and the header's value.

      For more information about the Strict-Transport-Security HTTP response header, see Strict-Transport-Security in the MDN Web Docs.

      • Override (boolean) -- [REQUIRED]

        A Boolean that determines whether CloudFront overrides the Strict-Transport-Security HTTP response header received from the origin with the one specified in this response headers policy.

      • IncludeSubdomains (boolean) --

        A Boolean that determines whether CloudFront includes the includeSubDomains directive in the Strict-Transport-Security HTTP response header.

      • Preload (boolean) --

        A Boolean that determines whether CloudFront includes the preload directive in the Strict-Transport-Security HTTP response header.

      • AccessControlMaxAgeSec (integer) -- [REQUIRED]

        A number that CloudFront uses as the value for the max-age directive in the Strict-Transport-Security HTTP response header.

  • ServerTimingHeadersConfig (dict) --

    A configuration for enabling the Server-Timing header in HTTP responses sent from CloudFront.

    • Enabled (boolean) -- [REQUIRED]

      A Boolean that determines whether CloudFront adds the Server-Timing header to HTTP responses that it sends in response to requests that match a cache behavior that's associated with this response headers policy.

    • SamplingRate (float) --

      A number 0–100 (inclusive) that specifies the percentage of responses that you want CloudFront to add the Server-Timing header to. When you set the sampling rate to 100, CloudFront adds the Server-Timing header to the HTTP response for every request that matches the cache behavior that this response headers policy is attached to. When you set it to 50, CloudFront adds the header to 50% of the responses for requests that match the cache behavior. You can set the sampling rate to any number 0–100 with up to four decimal places.

  • CustomHeadersConfig (dict) --

    A configuration for a set of custom HTTP response headers.

    • Quantity (integer) -- [REQUIRED]

      The number of HTTP response headers in the list.

    • Items (list) --

      The list of HTTP response headers and their values.

      • (dict) --

        An HTTP response header name and its value. CloudFront includes this header in HTTP responses that it sends for requests that match a cache behavior that's associated with this response headers policy.

        • Header (string) -- [REQUIRED]

          The HTTP response header name.

        • Value (string) -- [REQUIRED]

          The value for the HTTP response header.

        • Override (boolean) -- [REQUIRED]

          A Boolean that determines whether CloudFront overrides a response header with the same name received from the origin with the header specified here.

  • RemoveHeadersConfig (dict) --

    A configuration for a set of HTTP headers to remove from the HTTP response.

    • Quantity (integer) -- [REQUIRED]

      The number of HTTP header names in the list.

    • Items (list) --

      The list of HTTP header names.

      • (dict) --

        The name of an HTTP header that CloudFront removes from HTTP responses to requests that match the cache behavior that this response headers policy is attached to.

        • Header (string) -- [REQUIRED]

          The HTTP header name.

type Id

string

param Id

[REQUIRED]

The identifier for the response headers policy that you are updating.

type IfMatch

string

param IfMatch

The version of the response headers policy that you are updating.

The version is returned in the cache policy's ETag field in the response to GetResponseHeadersPolicyConfig .

rtype

dict

returns

Response Syntax

{
    'ResponseHeadersPolicy': {
        'Id': 'string',
        'LastModifiedTime': datetime(2015, 1, 1),
        'ResponseHeadersPolicyConfig': {
            'Comment': 'string',
            'Name': 'string',
            'CorsConfig': {
                'AccessControlAllowOrigins': {
                    'Quantity': 123,
                    'Items': [
                        'string',
                    ]
                },
                'AccessControlAllowHeaders': {
                    'Quantity': 123,
                    'Items': [
                        'string',
                    ]
                },
                'AccessControlAllowMethods': {
                    'Quantity': 123,
                    'Items': [
                        'GET'|'POST'|'OPTIONS'|'PUT'|'DELETE'|'PATCH'|'HEAD'|'ALL',
                    ]
                },
                'AccessControlAllowCredentials': True|False,
                'AccessControlExposeHeaders': {
                    'Quantity': 123,
                    'Items': [
                        'string',
                    ]
                },
                'AccessControlMaxAgeSec': 123,
                'OriginOverride': True|False
            },
            'SecurityHeadersConfig': {
                'XSSProtection': {
                    'Override': True|False,
                    'Protection': True|False,
                    'ModeBlock': True|False,
                    'ReportUri': 'string'
                },
                'FrameOptions': {
                    'Override': True|False,
                    'FrameOption': 'DENY'|'SAMEORIGIN'
                },
                'ReferrerPolicy': {
                    'Override': True|False,
                    'ReferrerPolicy': 'no-referrer'|'no-referrer-when-downgrade'|'origin'|'origin-when-cross-origin'|'same-origin'|'strict-origin'|'strict-origin-when-cross-origin'|'unsafe-url'
                },
                'ContentSecurityPolicy': {
                    'Override': True|False,
                    'ContentSecurityPolicy': 'string'
                },
                'ContentTypeOptions': {
                    'Override': True|False
                },
                'StrictTransportSecurity': {
                    'Override': True|False,
                    'IncludeSubdomains': True|False,
                    'Preload': True|False,
                    'AccessControlMaxAgeSec': 123
                }
            },
            'ServerTimingHeadersConfig': {
                'Enabled': True|False,
                'SamplingRate': 123.0
            },
            'CustomHeadersConfig': {
                'Quantity': 123,
                'Items': [
                    {
                        'Header': 'string',
                        'Value': 'string',
                        'Override': True|False
                    },
                ]
            },
            'RemoveHeadersConfig': {
                'Quantity': 123,
                'Items': [
                    {
                        'Header': 'string'
                    },
                ]
            }
        }
    },
    'ETag': 'string'
}

Response Structure

  • (dict) --

    • ResponseHeadersPolicy (dict) --

      A response headers policy.

      • Id (string) --

        The identifier for the response headers policy.

      • LastModifiedTime (datetime) --

        The date and time when the response headers policy was last modified.

      • ResponseHeadersPolicyConfig (dict) --

        A response headers policy configuration.

        • Comment (string) --

          A comment to describe the response headers policy.

          The comment cannot be longer than 128 characters.

        • Name (string) --

          A name to identify the response headers policy.

          The name must be unique for response headers policies in this Amazon Web Services account.

        • CorsConfig (dict) --

          A configuration for a set of HTTP response headers that are used for cross-origin resource sharing (CORS).

          • AccessControlAllowOrigins (dict) --

            A list of origins (domain names) that CloudFront can use as the value for the Access-Control-Allow-Origin HTTP response header.

            For more information about the Access-Control-Allow-Origin HTTP response header, see Access-Control-Allow-Origin in the MDN Web Docs.

            • Quantity (integer) --

              The number of origins in the list.

            • Items (list) --

              The list of origins (domain names). You can specify * to allow all origins.

              • (string) --

          • AccessControlAllowHeaders (dict) --

            A list of HTTP header names that CloudFront includes as values for the Access-Control-Allow-Headers HTTP response header.

            For more information about the Access-Control-Allow-Headers HTTP response header, see Access-Control-Allow-Headers in the MDN Web Docs.

            • Quantity (integer) --

              The number of HTTP header names in the list.

            • Items (list) --

              The list of HTTP header names. You can specify * to allow all headers.

              • (string) --

          • AccessControlAllowMethods (dict) --

            A list of HTTP methods that CloudFront includes as values for the Access-Control-Allow-Methods HTTP response header.

            For more information about the Access-Control-Allow-Methods HTTP response header, see Access-Control-Allow-Methods in the MDN Web Docs.

            • Quantity (integer) --

              The number of HTTP methods in the list.

            • Items (list) --

              The list of HTTP methods. Valid values are:

              • GET

              • DELETE

              • HEAD

              • OPTIONS

              • PATCH

              • POST

              • PUT

              • ALL

              ALL is a special value that includes all of the listed HTTP methods.

              • (string) --

          • AccessControlAllowCredentials (boolean) --

            A Boolean that CloudFront uses as the value for the Access-Control-Allow-Credentials HTTP response header.

            For more information about the Access-Control-Allow-Credentials HTTP response header, see Access-Control-Allow-Credentials in the MDN Web Docs.

          • AccessControlExposeHeaders (dict) --

            A list of HTTP headers that CloudFront includes as values for the Access-Control-Expose-Headers HTTP response header.

            For more information about the Access-Control-Expose-Headers HTTP response header, see Access-Control-Expose-Headers in the MDN Web Docs.

            • Quantity (integer) --

              The number of HTTP headers in the list.

            • Items (list) --

              The list of HTTP headers. You can specify * to expose all headers.

              • (string) --

          • AccessControlMaxAgeSec (integer) --

            A number that CloudFront uses as the value for the Access-Control-Max-Age HTTP response header.

            For more information about the Access-Control-Max-Age HTTP response header, see Access-Control-Max-Age in the MDN Web Docs.

          • OriginOverride (boolean) --

            A Boolean that determines whether CloudFront overrides HTTP response headers received from the origin with the ones specified in this response headers policy.

        • SecurityHeadersConfig (dict) --

          A configuration for a set of security-related HTTP response headers.

          • XSSProtection (dict) --

            Determines whether CloudFront includes the X-XSS-Protection HTTP response header and the header's value.

            For more information about the X-XSS-Protection HTTP response header, see X-XSS-Protection in the MDN Web Docs.

            • Override (boolean) --

              A Boolean that determines whether CloudFront overrides the X-XSS-Protection HTTP response header received from the origin with the one specified in this response headers policy.

            • Protection (boolean) --

              A Boolean that determines the value of the X-XSS-Protection HTTP response header. When this setting is true , the value of the X-XSS-Protection header is 1 . When this setting is false , the value of the X-XSS-Protection header is 0 .

              For more information about these settings, see X-XSS-Protection in the MDN Web Docs.

            • ModeBlock (boolean) --

              A Boolean that determines whether CloudFront includes the mode=block directive in the X-XSS-Protection header.

              For more information about this directive, see X-XSS-Protection in the MDN Web Docs.

            • ReportUri (string) --

              A reporting URI, which CloudFront uses as the value of the report directive in the X-XSS-Protection header.

              You cannot specify a ReportUri when ModeBlock is true .

              For more information about using a reporting URL, see X-XSS-Protection in the MDN Web Docs.

          • FrameOptions (dict) --

            Determines whether CloudFront includes the X-Frame-Options HTTP response header and the header's value.

            For more information about the X-Frame-Options HTTP response header, see X-Frame-Options in the MDN Web Docs.

            • Override (boolean) --

              A Boolean that determines whether CloudFront overrides the X-Frame-Options HTTP response header received from the origin with the one specified in this response headers policy.

            • FrameOption (string) --

              The value of the X-Frame-Options HTTP response header. Valid values are DENY and SAMEORIGIN .

              For more information about these values, see X-Frame-Options in the MDN Web Docs.

          • ReferrerPolicy (dict) --

            Determines whether CloudFront includes the Referrer-Policy HTTP response header and the header's value.

            For more information about the Referrer-Policy HTTP response header, see Referrer-Policy in the MDN Web Docs.

            • Override (boolean) --

              A Boolean that determines whether CloudFront overrides the Referrer-Policy HTTP response header received from the origin with the one specified in this response headers policy.

            • ReferrerPolicy (string) --

              The value of the Referrer-Policy HTTP response header. Valid values are:

              • no-referrer

              • no-referrer-when-downgrade

              • origin

              • origin-when-cross-origin

              • same-origin

              • strict-origin

              • strict-origin-when-cross-origin

              • unsafe-url

              For more information about these values, see Referrer-Policy in the MDN Web Docs.

          • ContentSecurityPolicy (dict) --

            The policy directives and their values that CloudFront includes as values for the Content-Security-Policy HTTP response header.

            For more information about the Content-Security-Policy HTTP response header, see Content-Security-Policy in the MDN Web Docs.

            • Override (boolean) --

              A Boolean that determines whether CloudFront overrides the Content-Security-Policy HTTP response header received from the origin with the one specified in this response headers policy.

            • ContentSecurityPolicy (string) --

              The policy directives and their values that CloudFront includes as values for the Content-Security-Policy HTTP response header.

          • ContentTypeOptions (dict) --

            Determines whether CloudFront includes the X-Content-Type-Options HTTP response header with its value set to nosniff .

            For more information about the X-Content-Type-Options HTTP response header, see X-Content-Type-Options in the MDN Web Docs.

            • Override (boolean) --

              A Boolean that determines whether CloudFront overrides the X-Content-Type-Options HTTP response header received from the origin with the one specified in this response headers policy.

          • StrictTransportSecurity (dict) --

            Determines whether CloudFront includes the Strict-Transport-Security HTTP response header and the header's value.

            For more information about the Strict-Transport-Security HTTP response header, see Strict-Transport-Security in the MDN Web Docs.

            • Override (boolean) --

              A Boolean that determines whether CloudFront overrides the Strict-Transport-Security HTTP response header received from the origin with the one specified in this response headers policy.

            • IncludeSubdomains (boolean) --

              A Boolean that determines whether CloudFront includes the includeSubDomains directive in the Strict-Transport-Security HTTP response header.

            • Preload (boolean) --

              A Boolean that determines whether CloudFront includes the preload directive in the Strict-Transport-Security HTTP response header.

            • AccessControlMaxAgeSec (integer) --

              A number that CloudFront uses as the value for the max-age directive in the Strict-Transport-Security HTTP response header.

        • ServerTimingHeadersConfig (dict) --

          A configuration for enabling the Server-Timing header in HTTP responses sent from CloudFront.

          • Enabled (boolean) --

            A Boolean that determines whether CloudFront adds the Server-Timing header to HTTP responses that it sends in response to requests that match a cache behavior that's associated with this response headers policy.

          • SamplingRate (float) --

            A number 0–100 (inclusive) that specifies the percentage of responses that you want CloudFront to add the Server-Timing header to. When you set the sampling rate to 100, CloudFront adds the Server-Timing header to the HTTP response for every request that matches the cache behavior that this response headers policy is attached to. When you set it to 50, CloudFront adds the header to 50% of the responses for requests that match the cache behavior. You can set the sampling rate to any number 0–100 with up to four decimal places.

        • CustomHeadersConfig (dict) --

          A configuration for a set of custom HTTP response headers.

          • Quantity (integer) --

            The number of HTTP response headers in the list.

          • Items (list) --

            The list of HTTP response headers and their values.

            • (dict) --

              An HTTP response header name and its value. CloudFront includes this header in HTTP responses that it sends for requests that match a cache behavior that's associated with this response headers policy.

              • Header (string) --

                The HTTP response header name.

              • Value (string) --

                The value for the HTTP response header.

              • Override (boolean) --

                A Boolean that determines whether CloudFront overrides a response header with the same name received from the origin with the header specified here.

        • RemoveHeadersConfig (dict) --

          A configuration for a set of HTTP headers to remove from the HTTP response.

          • Quantity (integer) --

            The number of HTTP header names in the list.

          • Items (list) --

            The list of HTTP header names.

            • (dict) --

              The name of an HTTP header that CloudFront removes from HTTP responses to requests that match the cache behavior that this response headers policy is attached to.

              • Header (string) --

                The HTTP header name.

    • ETag (string) --

      The current version of the response headers policy.