prerender_rails 0.1.16 → 0.1.17
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/prerender_rails.rb +5 -0
- data/prerender_rails.gemspec +1 -1
- data/test/lib/prerender_rails.rb +8 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6edf330fb3dcade0261ecc6be8d4ac63a1efdf7f
|
4
|
+
data.tar.gz: 4360662571ae5ad3a2688cf441a55085308a53af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 62a64d33161fb5528d07a958ff14a8895a1994c75b8bed2b55a650f56572c655cdddfbaee1555898d74b497c24b1e98deb3ab19adfdcdba523292fe1c6cc8baf
|
7
|
+
data.tar.gz: 8f180ca36cfc36d31eb1620761eede3d6ca720ce69fba13d4743768675b3c8c79c51734ad2d7035a53e9932087306f585d8f1737eebf8b384a25d2a4ddde1075
|
data/lib/prerender_rails.rb
CHANGED
@@ -150,6 +150,11 @@ module Rack
|
|
150
150
|
new_env["HTTPS"] = false and new_env["rack.url_scheme"] = "http" and new_env["SERVER_PORT"] = 80 if (match && match[1] == "http")
|
151
151
|
end
|
152
152
|
|
153
|
+
if env["X-FORWARDED-PROTO"]
|
154
|
+
new_env["HTTPS"] = true and new_env["rack.url_scheme"] = "https" and new_env["SERVER_PORT"] = 443 if env["X-FORWARDED-PROTO"] == "https"
|
155
|
+
new_env["HTTPS"] = false and new_env["rack.url_scheme"] = "http" and new_env["SERVER_PORT"] = 80 if env["X-FORWARDED-PROTO"] == "http"
|
156
|
+
end
|
157
|
+
|
153
158
|
url = Rack::Request.new(new_env).url
|
154
159
|
prerender_url = get_prerender_service_url()
|
155
160
|
forward_slash = prerender_url[-1, 1] == '/' ? '' : '/'
|
data/prerender_rails.gemspec
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |spec|
|
4
4
|
spec.name = "prerender_rails"
|
5
|
-
spec.version = "0.1.
|
5
|
+
spec.version = "0.1.17"
|
6
6
|
spec.authors = ["Todd Hooper"]
|
7
7
|
spec.email = ["todd@prerender.io"]
|
8
8
|
spec.description = %q{Rails middleware to prerender your javascript heavy pages on the fly by a phantomjs service}
|
data/test/lib/prerender_rails.rb
CHANGED
@@ -164,6 +164,14 @@ describe Rack::Prerender do
|
|
164
164
|
ENV['PRERENDER_SERVICE_URL'] = nil
|
165
165
|
assert_equal 'http://service.prerender.io/https://google.com/search?q=javascript', @prerender.build_api_url(request)
|
166
166
|
end
|
167
|
+
|
168
|
+
|
169
|
+
# Check X-Forwarded-Proto because Heroku SSL Support terminates at the load balancer
|
170
|
+
it "should build the correct api url for the Heroku SSL Addon support" do
|
171
|
+
request = Rack::MockRequest.env_for "http://google.com/search?q=javascript", { 'X-FORWARDED-PROTO' => 'https'}
|
172
|
+
ENV['PRERENDER_SERVICE_URL'] = nil
|
173
|
+
assert_equal 'http://service.prerender.io/https://google.com/search?q=javascript', @prerender.build_api_url(request)
|
174
|
+
end
|
167
175
|
end
|
168
176
|
|
169
177
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: prerender_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Todd Hooper
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rack
|