api_valve 0.7.5 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -0
- data/lib/api_valve/forwarder/request.rb +6 -5
- 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: 0077e2b67d1a99fcde84633c66f4bb2eb6cbd9b65e45b46a1bbc6f22f0a7bf47
|
4
|
+
data.tar.gz: e880e13b437165fa6678638fa7e8a632115a7587bf9024fdf86f81399c12ac75
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5802ab4c218221aabbb6921337165090911137ca5d42e66551706e7ab99cd0e9fe69000246ecbdf733605ae8b1bbab3aa8bc5b812786e6ba2450adeeb327fb25
|
7
|
+
data.tar.gz: d7e2f3dbe1b9fb27e2db8a5444adf05abb044dd6e5947fa8ecb0f729091bd2e96f24daf154f810333c4286feee99424a45a2cedd76831174386e3bb922abd00d
|
data/README.md
CHANGED
@@ -18,3 +18,21 @@ gem 'api_valve'
|
|
18
18
|
|
19
19
|
See the [examples](https://github.com/mkon/api_valve/tree/master/examples) section on how to
|
20
20
|
create & configure your own proxy using this gem.
|
21
|
+
|
22
|
+
### Headers
|
23
|
+
|
24
|
+
By default the following headers are forwarded:
|
25
|
+
|
26
|
+
* `Accept`
|
27
|
+
* `Content-Type`
|
28
|
+
* `User-Agent`
|
29
|
+
* `X-Real-IP`
|
30
|
+
* `X-Request-Id`
|
31
|
+
|
32
|
+
Additionally these headers are generated:
|
33
|
+
|
34
|
+
* `X-Forwarded-For`: The ApiGateway is added to the list
|
35
|
+
* `X-Forwarded-Host`: Filled with original request host
|
36
|
+
* `X-Forwarded-Port`: Filled with original request port
|
37
|
+
* `X-Forwarded-Prefix`: Filled with the path prefix of the forwarder within the Api Gateway (eg `SCRIPT_NAME` env)
|
38
|
+
* `X-Forwarded-Proto`: Filled with original request scheme
|
@@ -76,11 +76,12 @@ module ApiValve
|
|
76
76
|
|
77
77
|
def forwarded_headers
|
78
78
|
{
|
79
|
-
'X-Forwarded-For'
|
80
|
-
'X-Forwarded-Host'
|
81
|
-
'X-Forwarded-Port'
|
82
|
-
'X-Forwarded-
|
83
|
-
|
79
|
+
'X-Forwarded-For' => x_forwarded_for,
|
80
|
+
'X-Forwarded-Host' => original_request.host,
|
81
|
+
'X-Forwarded-Port' => original_request.port.to_s,
|
82
|
+
'X-Forwarded-Prefix' => original_request.env['SCRIPT_NAME'].presence,
|
83
|
+
'X-Forwarded-Proto' => original_request.scheme
|
84
|
+
}.compact
|
84
85
|
end
|
85
86
|
|
86
87
|
def override_path(options)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api_valve
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- mkon
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-05-
|
11
|
+
date: 2020-05-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|