roda-proxy 1.0.4 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/roda/proxy.rb +5 -1
- data/lib/roda/proxy/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eb409e70001e1014f578c5e960645dfec420ad322f9b7c3561fff14d4349d0ae
|
4
|
+
data.tar.gz: 3d77b1f29d562da8445c7bb18b2ccb58b1f021c6c67324b88c5628179c47c4d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79a72f29b5d54ad614cedb19fbb0cfedb5a728673e9047ea8e980873c6d48b49ea524fe35a7dda90caae0d9cd0504461ae3a521fbfbaad4016bcf9b262ea0fe3
|
7
|
+
data.tar.gz: f3e579a5517cd87f59125c276ca006e21b09ed738a8e99deaa8b6c1f051485f4b384ff068d418721b051a79223377242cd89d030eec540ced0e0a1b7e6dfe4a2
|
data/README.md
CHANGED
@@ -58,7 +58,7 @@ route do |r|
|
|
58
58
|
end
|
59
59
|
```
|
60
60
|
|
61
|
-
The proxy will always be invoked. Headers and body are passed through unmodified in both directions with the exception of `Host` which is rewritten to match the target.
|
61
|
+
The proxy will always be invoked. Headers and body are passed through unmodified in both directions with the exception of `Host` which is rewritten to match the target and `Via` which is created (or appended to if it already exists) to indicate the proxy path.
|
62
62
|
|
63
63
|
Also provided is a conditional proxy:
|
64
64
|
|
@@ -82,7 +82,7 @@ route do |r|
|
|
82
82
|
end
|
83
83
|
```
|
84
84
|
|
85
|
-
With `proxy_when` the first optional parameter expects a truthy value or a block / lambda that returns a truthy value. This must be equivalent to `true` for the proxying to occur. The optional probability is a float between 0 and 1 indicating the probability that proxying will happen. Both
|
85
|
+
With `proxy_when` the first optional parameter expects a truthy value or a block / lambda that returns a truthy value. This must be equivalent to `true` for the proxying to occur. The optional probability is a float between 0 and 1 indicating the probability that proxying will happen. Both parameters can be used alone or in isolation.
|
86
86
|
|
87
87
|
If and only if proxying does not occur will the block be evaluated and return to Roda for rendering.
|
88
88
|
|
data/lib/roda/proxy.rb
CHANGED
@@ -37,6 +37,7 @@ class Roda
|
|
37
37
|
def proxy
|
38
38
|
method = Faraday.method(env['REQUEST_METHOD'].downcase.to_sym)
|
39
39
|
f_response = method.call(_proxy_url) { |req| _proxy_request(req) }
|
40
|
+
# p f_response
|
40
41
|
_respond(f_response)
|
41
42
|
end
|
42
43
|
|
@@ -92,7 +93,10 @@ class Roda
|
|
92
93
|
|
93
94
|
def _respond(proxied_response)
|
94
95
|
response.status = proxied_response.status
|
95
|
-
proxied_response
|
96
|
+
proxied_response
|
97
|
+
.headers
|
98
|
+
.reject { |k, v| k.downcase == 'transfer-encoding' }
|
99
|
+
.each { |k, v| response[k] = v }
|
96
100
|
response['Via'] = _via_header_string
|
97
101
|
response.write(proxied_response.body)
|
98
102
|
end
|
data/lib/roda/proxy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: roda-proxy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nigel Brookes-Thomas
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-03-
|
11
|
+
date: 2020-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|