rails-reverse-proxy 0.7.1 → 0.10.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 72244cb52a629d2140ef2b9f99137849ae474bc2
4
- data.tar.gz: 042c91dbfa74fe63e8230d1f44367459c3cfb0a6
3
+ metadata.gz: 28f2553cbcd88d2176d2527f164b02e1f6b449fc
4
+ data.tar.gz: bd8e18ad3f8dd64bf29906f9c86004f46d15388f
5
5
  SHA512:
6
- metadata.gz: 59b6ede9dc6577a5914c545680bfb6478a26ea6d88952a8a3a24b51863464320abc9f6c7e38924e00942933ac081bb4d4993ef6fe6d6f7895d160ca4c83b41d3
7
- data.tar.gz: 6c530be6de9a95c64a143a06bc0e3cfd4cf80b692cdb3f7c76e927deb56802c1a0feed729607804c5531fefa09571176c45a0afa4515671c4878541c30b95391
6
+ metadata.gz: a34d6fec04b73d6021ea961468a2715e92db14118fdd689357228329f5a11d62db5a594723d9a08a5686273509f9a7e8eabfc56108aa3294d17cbe144152882f
7
+ data.tar.gz: 15e38cd70ab31749f0b170cfeed2ce6b41a98a892507000b4af0b33c4a02855a9bbdae57c1be7939bde2b33b711d29958117e45adb191e83cbbf9b94f758145f
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.4.2
data/Gemfile CHANGED
@@ -1,8 +1,6 @@
1
1
  source "http://rubygems.org"
2
2
 
3
- gem 'rails'
4
- gem 'rack'
5
- gem 'rack-proxy'
3
+ gem 'actionpack'
6
4
  gem 'addressable'
7
5
 
8
6
  # Add dependencies to develop your gem here.
@@ -11,6 +9,6 @@ group :development do
11
9
  gem "shoulda", ">= 0"
12
10
  gem "rdoc", "~> 3.12"
13
11
  gem "bundler", "~> 1.0"
14
- gem "jeweler", "~> 2.0.1"
12
+ gem "jeweler", "~> 2.1.2"
15
13
  gem "simplecov", ">= 0"
16
14
  end
data/Gemfile.lock CHANGED
@@ -1,12 +1,6 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- actionmailer (4.2.1)
5
- actionpack (= 4.2.1)
6
- actionview (= 4.2.1)
7
- activejob (= 4.2.1)
8
- mail (~> 2.5, >= 2.5.4)
9
- rails-dom-testing (~> 1.0, >= 1.0.5)
10
4
  actionpack (4.2.1)
11
5
  actionview (= 4.2.1)
12
6
  activesupport (= 4.2.1)
@@ -20,90 +14,64 @@ GEM
20
14
  erubis (~> 2.7.0)
21
15
  rails-dom-testing (~> 1.0, >= 1.0.5)
22
16
  rails-html-sanitizer (~> 1.0, >= 1.0.1)
23
- activejob (4.2.1)
24
- activesupport (= 4.2.1)
25
- globalid (>= 0.3.0)
26
- activemodel (4.2.1)
27
- activesupport (= 4.2.1)
28
- builder (~> 3.1)
29
- activerecord (4.2.1)
30
- activemodel (= 4.2.1)
31
- activesupport (= 4.2.1)
32
- arel (~> 6.0)
33
17
  activesupport (4.2.1)
34
18
  i18n (~> 0.7)
35
19
  json (~> 1.7, >= 1.7.7)
36
20
  minitest (~> 5.1)
37
21
  thread_safe (~> 0.3, >= 0.3.4)
38
22
  tzinfo (~> 1.1)
39
- addressable (2.3.8)
40
- arel (6.0.0)
41
- builder (3.2.2)
23
+ addressable (2.5.0)
24
+ public_suffix (~> 2.0, >= 2.0.2)
25
+ builder (3.2.3)
42
26
  descendants_tracker (0.0.4)
43
27
  thread_safe (~> 0.3, >= 0.3.1)
44
28
  docile (1.1.5)
45
29
  erubis (2.7.0)
46
- faraday (0.9.1)
30
+ faraday (0.9.2)
47
31
  multipart-post (>= 1.2, < 3)
48
- git (1.2.9.1)
49
- github_api (0.12.3)
32
+ git (1.3.0)
33
+ github_api (0.11.3)
50
34
  addressable (~> 2.3)
51
- descendants_tracker (~> 0.0.4)
35
+ descendants_tracker (~> 0.0.1)
52
36
  faraday (~> 0.8, < 0.10)
53
- hashie (>= 3.3)
37
+ hashie (>= 1.2)
54
38
  multi_json (>= 1.7.5, < 2.0)
55
- nokogiri (~> 1.6.3)
39
+ nokogiri (~> 1.6.0)
56
40
  oauth2
57
- globalid (0.3.5)
58
- activesupport (>= 4.1.0)
59
- hashie (3.4.2)
60
- highline (1.7.2)
41
+ hashie (3.5.5)
42
+ highline (1.7.8)
61
43
  i18n (0.7.0)
62
- jeweler (2.0.1)
44
+ jeweler (2.1.2)
63
45
  builder
64
46
  bundler (>= 1.0)
65
47
  git (>= 1.2.5)
66
- github_api
48
+ github_api (~> 0.11.0)
67
49
  highline (>= 1.6.15)
68
50
  nokogiri (>= 1.5.10)
69
51
  rake
70
52
  rdoc
71
- json (1.8.3)
72
- jwt (1.5.0)
53
+ semver
54
+ json (1.8.6)
55
+ jwt (1.5.6)
73
56
  loofah (2.0.2)
74
57
  nokogiri (>= 1.5.9)
75
- mail (2.6.3)
76
- mime-types (>= 1.16, < 3)
77
- mime-types (2.6.1)
78
- mini_portile (0.6.2)
58
+ mini_portile2 (2.1.0)
79
59
  minitest (5.7.0)
80
- multi_json (1.11.0)
81
- multi_xml (0.5.5)
60
+ multi_json (1.12.1)
61
+ multi_xml (0.6.0)
82
62
  multipart-post (2.0.0)
83
- nokogiri (1.6.6.2)
84
- mini_portile (~> 0.6.0)
85
- oauth2 (1.0.0)
86
- faraday (>= 0.8, < 0.10)
63
+ nokogiri (1.6.8.1)
64
+ mini_portile2 (~> 2.1.0)
65
+ oauth2 (1.3.1)
66
+ faraday (>= 0.8, < 0.12)
87
67
  jwt (~> 1.0)
88
68
  multi_json (~> 1.3)
89
69
  multi_xml (~> 0.5)
90
- rack (~> 1.2)
91
- rack (1.6.1)
92
- rack-proxy (0.5.17)
93
- rack
70
+ rack (>= 1.2, < 3)
71
+ public_suffix (2.0.5)
72
+ rack (1.6.5)
94
73
  rack-test (0.6.3)
95
74
  rack (>= 1.0)
96
- rails (4.2.1)
97
- actionmailer (= 4.2.1)
98
- actionpack (= 4.2.1)
99
- actionview (= 4.2.1)
100
- activejob (= 4.2.1)
101
- activemodel (= 4.2.1)
102
- activerecord (= 4.2.1)
103
- activesupport (= 4.2.1)
104
- bundler (>= 1.3.0, < 2.0)
105
- railties (= 4.2.1)
106
- sprockets-rails
107
75
  rails-deprecated_sanitizer (1.0.3)
108
76
  activesupport (>= 4.2.0.alpha)
109
77
  rails-dom-testing (1.0.6)
@@ -112,14 +80,10 @@ GEM
112
80
  rails-deprecated_sanitizer (>= 1.0.1)
113
81
  rails-html-sanitizer (1.0.2)
114
82
  loofah (~> 2.0)
115
- railties (4.2.1)
116
- actionpack (= 4.2.1)
117
- activesupport (= 4.2.1)
118
- rake (>= 0.8.7)
119
- thor (>= 0.18.1, < 2.0)
120
- rake (10.4.2)
83
+ rake (12.0.0)
121
84
  rdoc (3.12.2)
122
85
  json (~> 1.4)
86
+ semver (1.0.1)
123
87
  shoulda (3.5.0)
124
88
  shoulda-context (~> 1.0, >= 1.0.1)
125
89
  shoulda-matchers (>= 1.4.1, < 3.0)
@@ -131,14 +95,7 @@ GEM
131
95
  json (~> 1.8)
132
96
  simplecov-html (~> 0.10.0)
133
97
  simplecov-html (0.10.0)
134
- sprockets (3.2.0)
135
- rack (~> 1.0)
136
- sprockets-rails (2.3.1)
137
- actionpack (>= 3.0)
138
- activesupport (>= 3.0)
139
- sprockets (>= 2.8, < 4.0)
140
- thor (0.19.1)
141
- thread_safe (0.3.5)
98
+ thread_safe (0.3.6)
142
99
  tzinfo (1.2.2)
143
100
  thread_safe (~> 0.1)
144
101
 
@@ -146,15 +103,13 @@ PLATFORMS
146
103
  ruby
147
104
 
148
105
  DEPENDENCIES
106
+ actionpack
149
107
  addressable
150
108
  bundler (~> 1.0)
151
- jeweler (~> 2.0.1)
152
- rack
153
- rack-proxy
154
- rails
109
+ jeweler (~> 2.1.2)
155
110
  rdoc (~> 3.12)
156
111
  shoulda
157
112
  simplecov
158
113
 
159
114
  BUNDLED WITH
160
- 1.10.6
115
+ 1.14.5
data/README.md CHANGED
@@ -1,10 +1,12 @@
1
1
  # rails-reverse-proxy
2
2
 
3
- Gives you the ability to reverse proxy within Rails.
3
+ A reverse proxy for Ruby on Rails.
4
+
5
+ *A reverse proxy accepts a request from a client, forwards it to a server that can fulfill it, and returns the server's response to the client*
4
6
 
5
7
  ## Installation
6
8
 
7
- You know the drill. In your Gemfile, have the line
9
+ You know the drill. In your Gemfile
8
10
 
9
11
  ```ruby
10
12
  gem 'rails-reverse-proxy'
@@ -18,7 +20,9 @@ $ bundle
18
20
 
19
21
  ## Usage
20
22
 
21
- An example usage of this gem is hosting a WordPress site on a path within your Rails application, such as `/blog`. To do this, you'll need something like
23
+ A use case for this gem is serving WordPress on a path within your Rails application, such as `/blog`.
24
+
25
+ To do this, your controller might look like this
22
26
 
23
27
  ```ruby
24
28
  class WordpressController < ApplicationController
@@ -34,6 +38,7 @@ class WordpressController < ApplicationController
34
38
 
35
39
  # There's also other callbacks:
36
40
  # - on_set_cookies
41
+ # - on_connect
37
42
  # - on_response
38
43
  # - on_set_cookies
39
44
  # - on_success
@@ -64,7 +69,13 @@ If you'd like to bypass SSL verification
64
69
  reverse_proxy "http://localhost:8000", verify_ssl: false
65
70
  ```
66
71
 
67
- Use this method to determine what version you're running
72
+ If you'd like to customize options passed into the underlying [`Net:HTTP`](https://ruby-doc.org/stdlib-2.4.0/libdoc/net/http/rdoc/Net/HTTP.html#start-method) object
73
+
74
+ ```ruby
75
+ reverse_proxy "http://localhost:8000", http: { read_timeout: 20, open_timeout: 100 }
76
+ ```
77
+
78
+ Determine what version you're using
68
79
 
69
80
  ```ruby
70
81
  ReverseProxy.version
@@ -76,15 +87,14 @@ Feel free to open an issue!
76
87
 
77
88
  All pull requests will become first class citizens.
78
89
 
79
- ## Thanks
90
+ ## Contributors
80
91
 
81
- Special thanks to our contributors!
92
+ Special thanks to our contributors!
82
93
 
94
+ - [mediafinger](https://github.com/mediafinger)
83
95
  - [miyukki](https://github.com/miyukki)
84
96
  - [bapirex](https://github.com/bapirex)
85
-
86
- ## Copyright
87
-
88
- Copyright (c) 2016 James Hu. See [LICENSE](LICENSE) for
89
- further details.
90
-
97
+ - [marcosbeirigo](https://github.com/marcosbeirigo)
98
+ - [avinashkoulavkar](https://github.com/avinashkoulavkar)
99
+ - [jcs](https://github.com/jcs)
100
+ - [aardvarkk](https://github.com/aardvarkk)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.7.1
1
+ 0.10.1
@@ -1,5 +1,4 @@
1
1
  require 'rack'
2
- require 'rack-proxy'
3
2
  require 'addressable/uri'
4
3
 
5
4
  module ReverseProxy
@@ -7,6 +6,7 @@ module ReverseProxy
7
6
  @@callback_methods = [
8
7
  :on_response,
9
8
  :on_set_cookies,
9
+ :on_connect,
10
10
  :on_success,
11
11
  :on_redirect,
12
12
  :on_missing,
@@ -38,6 +38,7 @@ module ReverseProxy
38
38
  def request(env, options = {}, &block)
39
39
  options.reverse_merge!(
40
40
  headers: {},
41
+ http: {},
41
42
  path: nil,
42
43
  username: nil,
43
44
  password: nil,
@@ -81,10 +82,12 @@ module ReverseProxy
81
82
 
82
83
  http_options = {}
83
84
  http_options[:use_ssl] = (uri.scheme == "https")
84
- http_options[:verify_mode] = OpenSSL::SSL::VERIFY_NONE if options[:verify_ssl]
85
+ http_options[:verify_mode] = OpenSSL::SSL::VERIFY_NONE unless options[:verify_ssl]
86
+ http_options.merge!(options[:http]) if options[:http]
85
87
 
86
88
  # Make the request
87
89
  Net::HTTP.start(uri.hostname, uri.port, http_options) do |http|
90
+ callbacks[:on_connect].call(http)
88
91
  target_response = http.request(target_request)
89
92
  end
90
93
 
@@ -127,7 +130,7 @@ module ReverseProxy
127
130
 
128
131
  def extract_http_request_headers(env)
129
132
  headers = env.reject do |k, v|
130
- !(/^HTTP_[A-Z_]+$/ === k) || v.nil?
133
+ !(/^HTTP_[A-Z_]+$/ === k) || k == "HTTP_VERSION" || v.nil?
131
134
  end.map do |k, v|
132
135
  [reconstruct_header_name(k), v]
133
136
  end.inject(Rack::Utils::HeaderHash.new) do |hash, k_v|
@@ -2,24 +2,25 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: rails-reverse-proxy 0.7.1 ruby lib
5
+ # stub: rails-reverse-proxy 0.10.1 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
- s.name = "rails-reverse-proxy"
9
- s.version = "0.7.1"
8
+ s.name = "rails-reverse-proxy".freeze
9
+ s.version = "0.10.1"
10
10
 
11
- s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
- s.require_paths = ["lib"]
13
- s.authors = ["James Hu"]
14
- s.date = "2016-10-28"
15
- s.description = "Reverse proxy for Ruby on Rails"
16
- s.email = "hello@james.hu"
11
+ s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
+ s.require_paths = ["lib".freeze]
13
+ s.authors = ["James Hu".freeze]
14
+ s.date = "2021-03-24"
15
+ s.description = "Reverse proxy for Ruby on Rails".freeze
16
+ s.email = "hello@james.hu".freeze
17
17
  s.extra_rdoc_files = [
18
18
  "LICENSE",
19
19
  "README.md"
20
20
  ]
21
21
  s.files = [
22
22
  ".document",
23
+ ".ruby-version",
23
24
  "Gemfile",
24
25
  "Gemfile.lock",
25
26
  "LICENSE",
@@ -33,45 +34,39 @@ Gem::Specification.new do |s|
33
34
  "lib/reverse_proxy/controller.rb",
34
35
  "rails-reverse-proxy.gemspec"
35
36
  ]
36
- s.homepage = "http://github.com/axsuul/rails-reverse-proxy"
37
- s.licenses = ["MIT"]
38
- s.rubygems_version = "2.4.5"
39
- s.summary = "Reverse proxy for Ruby on Rails"
37
+ s.homepage = "http://github.com/axsuul/rails-reverse-proxy".freeze
38
+ s.licenses = ["MIT".freeze]
39
+ s.rubygems_version = "2.6.13".freeze
40
+ s.summary = "Reverse proxy for Ruby on Rails".freeze
40
41
 
41
42
  if s.respond_to? :specification_version then
42
43
  s.specification_version = 4
43
44
 
44
45
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
45
- s.add_runtime_dependency(%q<rails>, [">= 0"])
46
- s.add_runtime_dependency(%q<rack>, [">= 0"])
47
- s.add_runtime_dependency(%q<rack-proxy>, [">= 0"])
48
- s.add_runtime_dependency(%q<addressable>, [">= 0"])
49
- s.add_development_dependency(%q<shoulda>, [">= 0"])
50
- s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
51
- s.add_development_dependency(%q<bundler>, ["~> 1.0"])
52
- s.add_development_dependency(%q<jeweler>, ["~> 2.0.1"])
53
- s.add_development_dependency(%q<simplecov>, [">= 0"])
46
+ s.add_runtime_dependency(%q<actionpack>.freeze, [">= 0"])
47
+ s.add_runtime_dependency(%q<addressable>.freeze, [">= 0"])
48
+ s.add_development_dependency(%q<shoulda>.freeze, [">= 0"])
49
+ s.add_development_dependency(%q<rdoc>.freeze, ["~> 3.12"])
50
+ s.add_development_dependency(%q<bundler>.freeze, ["~> 1.0"])
51
+ s.add_development_dependency(%q<jeweler>.freeze, ["~> 2.1.2"])
52
+ s.add_development_dependency(%q<simplecov>.freeze, [">= 0"])
54
53
  else
55
- s.add_dependency(%q<rails>, [">= 0"])
56
- s.add_dependency(%q<rack>, [">= 0"])
57
- s.add_dependency(%q<rack-proxy>, [">= 0"])
58
- s.add_dependency(%q<addressable>, [">= 0"])
59
- s.add_dependency(%q<shoulda>, [">= 0"])
60
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
61
- s.add_dependency(%q<bundler>, ["~> 1.0"])
62
- s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
63
- s.add_dependency(%q<simplecov>, [">= 0"])
54
+ s.add_dependency(%q<actionpack>.freeze, [">= 0"])
55
+ s.add_dependency(%q<addressable>.freeze, [">= 0"])
56
+ s.add_dependency(%q<shoulda>.freeze, [">= 0"])
57
+ s.add_dependency(%q<rdoc>.freeze, ["~> 3.12"])
58
+ s.add_dependency(%q<bundler>.freeze, ["~> 1.0"])
59
+ s.add_dependency(%q<jeweler>.freeze, ["~> 2.1.2"])
60
+ s.add_dependency(%q<simplecov>.freeze, [">= 0"])
64
61
  end
65
62
  else
66
- s.add_dependency(%q<rails>, [">= 0"])
67
- s.add_dependency(%q<rack>, [">= 0"])
68
- s.add_dependency(%q<rack-proxy>, [">= 0"])
69
- s.add_dependency(%q<addressable>, [">= 0"])
70
- s.add_dependency(%q<shoulda>, [">= 0"])
71
- s.add_dependency(%q<rdoc>, ["~> 3.12"])
72
- s.add_dependency(%q<bundler>, ["~> 1.0"])
73
- s.add_dependency(%q<jeweler>, ["~> 2.0.1"])
74
- s.add_dependency(%q<simplecov>, [">= 0"])
63
+ s.add_dependency(%q<actionpack>.freeze, [">= 0"])
64
+ s.add_dependency(%q<addressable>.freeze, [">= 0"])
65
+ s.add_dependency(%q<shoulda>.freeze, [">= 0"])
66
+ s.add_dependency(%q<rdoc>.freeze, ["~> 3.12"])
67
+ s.add_dependency(%q<bundler>.freeze, ["~> 1.0"])
68
+ s.add_dependency(%q<jeweler>.freeze, ["~> 2.1.2"])
69
+ s.add_dependency(%q<simplecov>.freeze, [">= 0"])
75
70
  end
76
71
  end
77
72
 
metadata CHANGED
@@ -1,45 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-reverse-proxy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.1
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Hu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-10-28 00:00:00.000000000 Z
11
+ date: 2021-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rails
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
- - !ruby/object:Gem::Dependency
28
- name: rack
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: '0'
34
- type: :runtime
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - ">="
39
- - !ruby/object:Gem::Version
40
- version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rack-proxy
14
+ name: actionpack
43
15
  requirement: !ruby/object:Gem::Requirement
44
16
  requirements:
45
17
  - - ">="
@@ -114,14 +86,14 @@ dependencies:
114
86
  requirements:
115
87
  - - "~>"
116
88
  - !ruby/object:Gem::Version
117
- version: 2.0.1
89
+ version: 2.1.2
118
90
  type: :development
119
91
  prerelease: false
120
92
  version_requirements: !ruby/object:Gem::Requirement
121
93
  requirements:
122
94
  - - "~>"
123
95
  - !ruby/object:Gem::Version
124
- version: 2.0.1
96
+ version: 2.1.2
125
97
  - !ruby/object:Gem::Dependency
126
98
  name: simplecov
127
99
  requirement: !ruby/object:Gem::Requirement
@@ -145,6 +117,7 @@ extra_rdoc_files:
145
117
  - README.md
146
118
  files:
147
119
  - ".document"
120
+ - ".ruby-version"
148
121
  - Gemfile
149
122
  - Gemfile.lock
150
123
  - LICENSE
@@ -177,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
150
  version: '0'
178
151
  requirements: []
179
152
  rubyforge_project:
180
- rubygems_version: 2.4.5
153
+ rubygems_version: 2.6.13
181
154
  signing_key:
182
155
  specification_version: 4
183
156
  summary: Reverse proxy for Ruby on Rails