rollbar 0.11.3 → 0.11.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/rollbar/request_data_extractor.rb +10 -2
- data/lib/rollbar/version.rb +1 -1
- data/spec/controllers/home_controller_spec.rb +28 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8082846880731311ecb0f18a70e1beb6db7b186d
|
4
|
+
data.tar.gz: c9378f92930c2f40e13cfb587d52d392db3c6800
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b16682566ae76dd0ec673427e4e3eac2eec91e9ab87cf47c3803e683464a8dc82baa13c48ac2a94a96488bdcb829752c6ed9d267f480ed5b94b66aa0f8d37c65
|
7
|
+
data.tar.gz: ef469ba5168631c3a49a2f775f09e1d0e7c8f742eb7f122e7c47da8d26e8424cdd62da0317ec44cf17718ad9ac845dee12804df46acb331f11026e56f9696f25
|
data/CHANGELOG.md
CHANGED
@@ -52,12 +52,20 @@ module Rollbar
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def rollbar_url(env)
|
55
|
-
scheme = env['rack.url_scheme']
|
56
|
-
|
55
|
+
scheme = env['HTTP_X_FORWARDED_PROTO'] || env['rack.url_scheme']
|
56
|
+
|
57
|
+
host = env['HTTP_X_FORWARDED_HOST'] || env['HTTP_HOST'] || env['SERVER_NAME']
|
57
58
|
path = env['ORIGINAL_FULLPATH'] || env['REQUEST_URI']
|
58
59
|
unless path.nil? || path.empty?
|
59
60
|
path = '/' + path.to_s if path.to_s.slice(0, 1) != '/'
|
60
61
|
end
|
62
|
+
|
63
|
+
port = env['HTTP_X_FORWARDED_PORT']
|
64
|
+
if port && !(scheme.downcase == 'http' && port.to_i == 80) && \
|
65
|
+
!(scheme.downcase == 'https' && port.to_i == 443) && \
|
66
|
+
!(host.include? ':')
|
67
|
+
host = host + ':' + port
|
68
|
+
end
|
61
69
|
|
62
70
|
[scheme, '://', host, path].join
|
63
71
|
end
|
data/lib/rollbar/version.rb
CHANGED
@@ -159,6 +159,34 @@ describe HomeController do
|
|
159
159
|
|
160
160
|
controller.send(:rollbar_request_data)[:url].should == 'http://rollbar.com'
|
161
161
|
end
|
162
|
+
|
163
|
+
it "should respect forwarded host" do
|
164
|
+
req = controller.request
|
165
|
+
req.host = '127.0.0.1:8080'
|
166
|
+
req.env['HTTP_X_FORWARDED_HOST'] = 'test.com'
|
167
|
+
|
168
|
+
controller.send(:rollbar_request_data)[:url].should == 'http://test.com'
|
169
|
+
end
|
170
|
+
|
171
|
+
it "should respect forwarded proto" do
|
172
|
+
req = controller.request
|
173
|
+
req.host = 'rollbar.com'
|
174
|
+
req.env['HTTP_X_FORWARDED_PROTO'] = 'https'
|
175
|
+
|
176
|
+
controller.send(:rollbar_request_data)[:url].should == 'https://rollbar.com'
|
177
|
+
end
|
178
|
+
|
179
|
+
it "should respect forwarded port" do
|
180
|
+
req = controller.request
|
181
|
+
req.host = '127.0.0.1:8080'
|
182
|
+
req.env['HTTP_X_FORWARDED_HOST'] = 'test.com'
|
183
|
+
req.env['HTTP_X_FORWARDED_PORT'] = '80'
|
184
|
+
|
185
|
+
controller.send(:rollbar_request_data)[:url].should == 'http://test.com'
|
186
|
+
|
187
|
+
req.env['HTTP_X_FORWARDED_PORT'] = '81'
|
188
|
+
controller.send(:rollbar_request_data)[:url].should == 'http://test.com:81'
|
189
|
+
end
|
162
190
|
end
|
163
191
|
|
164
192
|
context "rollbar_user_ip" do
|