Class: AWSCDK::CloudFront::CfnOriginRequestPolicy::OriginRequestPolicyConfigProperty

Inherits:
Jsii::Struct
  • Object
show all
Defined in:
cloud_front/cfn_origin_request_policy.rb

Overview

An origin request policy configuration.

This configuration determines the values that CloudFront includes in requests that it sends to the origin. Each request that CloudFront sends to the origin includes the following:

  • The request body and the URL path (without the domain name) from the viewer request.
  • The headers that CloudFront automatically includes in every origin request, including Host , User-Agent , and X-Amz-Cf-Id .
  • All HTTP headers, cookies, and URL query strings that are specified in the cache policy or the origin request policy. These can include items from the viewer request and, in the case of headers, additional ones that are added by CloudFront.

CloudFront sends a request when it can't find an object in its cache that matches the request. If you want to send values to the origin and also include them in the cache key, use CachePolicy .

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cookies_config:, headers_config:, name:, query_strings_config:, comment: nil) ⇒ OriginRequestPolicyConfigProperty

Returns a new instance of OriginRequestPolicyConfigProperty.

Parameters:



635
636
637
638
639
640
641
642
643
644
645
646
# File 'cloud_front/cfn_origin_request_policy.rb', line 635

def initialize(cookies_config:, headers_config:, name:, query_strings_config:, comment: nil)
  @cookies_config = cookies_config.is_a?(Hash) ? ::AWSCDK::CloudFront::CfnOriginRequestPolicy::CookiesConfigProperty.new(**cookies_config.transform_keys(&:to_sym)) : cookies_config
  Jsii::Type.check_type(@cookies_config, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZGZyb250LkNmbk9yaWdpblJlcXVlc3RQb2xpY3kuQ29va2llc0NvbmZpZ1Byb3BlcnR5In1dfX0=")), "cookiesConfig")
  @headers_config = headers_config.is_a?(Hash) ? ::AWSCDK::CloudFront::CfnOriginRequestPolicy::HeadersConfigProperty.new(**headers_config.transform_keys(&:to_sym)) : headers_config
  Jsii::Type.check_type(@headers_config, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZGZyb250LkNmbk9yaWdpblJlcXVlc3RQb2xpY3kuSGVhZGVyc0NvbmZpZ1Byb3BlcnR5In1dfX0=")), "headersConfig")
  @name = name
  Jsii::Type.check_type(@name, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "name")
  @query_strings_config = query_strings_config.is_a?(Hash) ? ::AWSCDK::CloudFront::CfnOriginRequestPolicy::QueryStringsConfigProperty.new(**query_strings_config.transform_keys(&:to_sym)) : query_strings_config
  Jsii::Type.check_type(@query_strings_config, JSON.parse(Base64.strict_decode64("eyJ1bmlvbiI6eyJ0eXBlcyI6W3siZnFuIjoiYXdzLWNkay1saWIuSVJlc29sdmFibGUifSx7ImZxbiI6ImF3cy1jZGstbGliLmF3c19jbG91ZGZyb250LkNmbk9yaWdpblJlcXVlc3RQb2xpY3kuUXVlcnlTdHJpbmdzQ29uZmlnUHJvcGVydHkifV19fQ==")), "queryStringsConfig")
  @comment = comment
  Jsii::Type.check_type(@comment, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "comment") unless @comment.nil?
end

Instance Attribute Details

#commentString? (readonly)

A comment to describe the origin request policy.

The comment cannot be longer than 128 characters.



676
677
678
# File 'cloud_front/cfn_origin_request_policy.rb', line 676

def comment
  @comment
end

#headers_configAWSCDK::IResolvable, AWSCDK::CloudFront::CfnOriginRequestPolicy::HeadersConfigProperty (readonly)

The HTTP headers to include in origin requests.

These can include headers from viewer requests and additional headers added by CloudFront.



659
660
661
# File 'cloud_front/cfn_origin_request_policy.rb', line 659

def headers_config
  @headers_config
end

#nameString (readonly)

A unique name to identify the origin request policy.



664
665
666
# File 'cloud_front/cfn_origin_request_policy.rb', line 664

def name
  @name
end

Class Method Details

.jsii_propertiesObject



678
679
680
681
682
683
684
685
686
# File 'cloud_front/cfn_origin_request_policy.rb', line 678

def self.jsii_properties
  {
    :cookies_config => "cookiesConfig",
    :headers_config => "headersConfig",
    :name => "name",
    :query_strings_config => "queryStringsConfig",
    :comment => "comment",
  }
end

Instance Method Details

#to_jsiiObject



688
689
690
691
692
693
694
695
696
697
698
# File 'cloud_front/cfn_origin_request_policy.rb', line 688

def to_jsii
  result = {}
  result.merge!({
    "cookiesConfig" => @cookies_config,
    "headersConfig" => @headers_config,
    "name" => @name,
    "queryStringsConfig" => @query_strings_config,
    "comment" => @comment,
  })
  result.compact
end