ssl_enforcer 0.1.3 → 0.1.4

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.3
1
+ 0.1.4
data/lib/ssl_enforcer.rb CHANGED
@@ -13,7 +13,7 @@ class SSLEnforcer
13
13
  if url_is_ok?(env)
14
14
  @app.call(env)
15
15
  else # if the domain is NOT currently using SSL then we need to redirect the request
16
- req = Rack::Request.new(env)
16
+ req = Rack::Request.new(env)
17
17
  headers = { "Location" => req.url.gsub(/^http:/, "https:") }
18
18
 
19
19
  [301, headers, []]
@@ -25,7 +25,11 @@ class SSLEnforcer
25
25
  def url_is_ok?(env)
26
26
  tld = get_top_level_domain(env["SERVER_NAME"])
27
27
  subdomain = get_subdomain(env["SERVER_NAME"], tld)
28
- scheme = env["rack.url_scheme"]
28
+
29
+ # Hack to deal with heroku redirect issues.
30
+ # http://rack.lighthouseapp.com/projects/22435/tickets/101
31
+ scheme = "https" if env["SERVER_PORT"] == "443"
32
+ scheme = env["HTTP_X_FORWARDED_PROTO"] if env["HTTP_X_FORWARDED_PROTO"]
29
33
 
30
34
  # If the subdomain is in the list of HTTPS enforced subs, check for HTTPS
31
35
  # otherwise, return true
data/ssl_enforcer.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "ssl_enforcer"
8
- s.version = "0.1.3"
8
+ s.version = "0.1.4"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["JD Hendrickson"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ssl_enforcer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -110,7 +110,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
110
110
  version: '0'
111
111
  segments:
112
112
  - 0
113
- hash: -3637057370550802770
113
+ hash: -3686267842636745665
114
114
  required_rubygems_version: !ruby/object:Gem::Requirement
115
115
  none: false
116
116
  requirements: