ssl_enforcer 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/ssl_enforcer.rb +6 -2
- data/ssl_enforcer.gemspec +1 -1
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
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
|
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
|
-
|
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
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.
|
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: -
|
113
|
+
hash: -3686267842636745665
|
114
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
115
|
none: false
|
116
116
|
requirements:
|