actionpack-cloudfront 1.0.2 → 1.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,23 @@
1
+ module ActionPack
2
+ module Cloudfront
3
+ module LocationHeaders
4
+ extend ActiveSupport::Concern
5
+
6
+ EU_ISO_3166_ALPHA_2 = /^(AL|AD|AT|BY|BE|BA|BG|HR|CY|CZ|DK|EE|FI
7
+ |FR|DE|GI|GR|HU|IS|IE|IM|IT|RS|LV|LI|LT
8
+ |LU|MK|MT|MD|MC|ME|NL|NO|PL|PT|RO|RU|SM
9
+ |RS|SK|SI|ES|SE|CH|UA|GB|VA|RS)$/ix
10
+
11
+ included do
12
+ helper_method :request_eu?
13
+ end
14
+
15
+ private
16
+
17
+ def request_eu?
18
+ country_code = request.headers['CloudFront-Viewer-Country']
19
+ !(country_code =~ EU_ISO_3166_ALPHA_2).nil?
20
+ end
21
+ end
22
+ end
23
+ end
@@ -14,6 +14,10 @@ module ActionPack
14
14
  end
15
15
  end
16
16
 
17
+ config.to_prepare do
18
+ ::ApplicationController.send :include, ActionPack::Cloudfront::LocationHeaders
19
+ end
20
+
17
21
  end
18
22
  end
19
23
  end
@@ -1,5 +1,5 @@
1
1
  module ActionPack
2
2
  module Cloudfront
3
- VERSION = '1.0.2'.freeze
3
+ VERSION = '1.0.3'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionpack-cloudfront
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.2
4
+ version: 1.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ken Collins
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-14 00:00:00.000000000 Z
11
+ date: 2019-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -108,6 +108,7 @@ files:
108
108
  - lib/action_pack/cloudfront.rb
109
109
  - lib/action_pack/cloudfront/ip-ranges.json
110
110
  - lib/action_pack/cloudfront/ip_ranges.rb
111
+ - lib/action_pack/cloudfront/location_headers.rb
111
112
  - lib/action_pack/cloudfront/railtie.rb
112
113
  - lib/action_pack/cloudfront/version.rb
113
114
  - lib/actionpack-cloudfront.rb
@@ -131,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
132
  version: '0'
132
133
  requirements: []
133
134
  rubyforge_project:
134
- rubygems_version: 2.6.8
135
+ rubygems_version: 2.7.6.2
135
136
  signing_key:
136
137
  specification_version: 4
137
138
  summary: Configure ActionDispatch::RemoteIp trusted proxies for Amazon CloudFront.