Class: AWSCDK::CloudFront::OriginRequestHeaderBehavior

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

Overview

Determines whether any HTTP headers (and if so, which headers) are included in requests that CloudFront sends to the origin.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ OriginRequestHeaderBehavior

Returns a new instance of OriginRequestHeaderBehavior.

Raises:

  • (NoMethodError)


8
9
10
# File 'cloud_front/origin_request_header_behavior.rb', line 8

def initialize(*args)
  raise NoMethodError, "aws-cdk-lib.aws_cloudfront.OriginRequestHeaderBehavior does not have a visible constructor; use the provided factory methods"
end

Class Method Details

.all(*cloudfront_headers) ⇒ AWSCDK::CloudFront::OriginRequestHeaderBehavior

All HTTP headers in viewer requests are included in requests that CloudFront sends to the origin.

Additionally, any additional CloudFront headers provided are included; the additional headers are added by CloudFront.

Parameters:

  • cloudfront_headers (Array<String>)

Returns:

  • (AWSCDK::CloudFront::OriginRequestHeaderBehavior)

See Also:



26
27
28
29
30
31
# File 'cloud_front/origin_request_header_behavior.rb', line 26

def self.all(*cloudfront_headers)
  cloudfront_headers.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "cloudfrontHeaders[#{index}]")
  end
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_cloudfront.OriginRequestHeaderBehavior", "all", [*cloudfront_headers])
end

.allow_list(*headers) ⇒ AWSCDK::CloudFront::OriginRequestHeaderBehavior

Listed headers are included in requests that CloudFront sends to the origin.

Parameters:

  • headers (Array<String>)

Returns:

  • (AWSCDK::CloudFront::OriginRequestHeaderBehavior)


37
38
39
40
41
42
# File 'cloud_front/origin_request_header_behavior.rb', line 37

def self.allow_list(*headers)
  headers.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "headers[#{index}]")
  end
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_cloudfront.OriginRequestHeaderBehavior", "allowList", [*headers])
end

.deny_list(*headers) ⇒ AWSCDK::CloudFront::OriginRequestHeaderBehavior

All headers except the provided headers are included in requests that CloudFront sends to the origin.

Parameters:

  • headers (Array<String>)

Returns:

  • (AWSCDK::CloudFront::OriginRequestHeaderBehavior)


48
49
50
51
52
53
# File 'cloud_front/origin_request_header_behavior.rb', line 48

def self.deny_list(*headers)
  headers.each_with_index do |item, index|
    Jsii::Type.check_type(item, JSON.parse(Base64.strict_decode64("eyJwcmltaXRpdmUiOiJzdHJpbmcifQ==")), "headers[#{index}]")
  end
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_cloudfront.OriginRequestHeaderBehavior", "denyList", [*headers])
end

.jsii_overridable_methodsObject



12
13
14
15
16
17
# File 'cloud_front/origin_request_header_behavior.rb', line 12

def self.jsii_overridable_methods
  {
    :behavior => { kind: :property, name: "behavior", is_optional: false },
    :headers => { kind: :property, name: "headers", is_optional: true },
  }
end

.noneAWSCDK::CloudFront::OriginRequestHeaderBehavior

HTTP headers are not included in requests that CloudFront sends to the origin.

Any headers that are listed in a CachePolicy are still included in origin requests.

Returns:

  • (AWSCDK::CloudFront::OriginRequestHeaderBehavior)


60
61
62
# File 'cloud_front/origin_request_header_behavior.rb', line 60

def self.none()
  Jsii::Kernel.instance.call_static("aws-cdk-lib.aws_cloudfront.OriginRequestHeaderBehavior", "none", [])
end

Instance Method Details

#behaviorString

The behavior of headers: allow all, none or an allow list.

Returns:

  • (String)


67
68
69
# File 'cloud_front/origin_request_header_behavior.rb', line 67

def behavior()
  jsii_get_property("behavior")
end

#headersArray<String>?

The headers for the allow list or the included CloudFront headers, if applicable.

Returns:

  • (Array<String>, nil)


74
75
76
# File 'cloud_front/origin_request_header_behavior.rb', line 74

def headers()
  jsii_get_property("headers")
end