rails-reverse-proxy 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +1 -0
- data/Gemfile.lock +2 -0
- data/README.md +59 -1
- data/VERSION +1 -1
- data/rails-reverse-proxy.gemspec +4 -1
- metadata +15 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 827ac656c2ddbf1b3edcc5b5452bef61c31ceef1
|
4
|
+
data.tar.gz: 39bd1a50bfaab0c1c93f22979247fab0efe36fa8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc6c602bfc549ce0d61c4080b40d0510da277146a093bceffbcdafde92f878d95a21f2112b4d045a8e85360a7f8bcf416ff726a59fecfa77f8694b538bd018ae
|
7
|
+
data.tar.gz: d1462902fa4d1d276bc46c3cc6b989395c8dc6eaa6ba72ca284e0b19878cb2d4a2ad98c4baa6df2b0bf68d369c5deef49f77a26b5089da4732ca1e8c73ad054f
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -39,6 +39,7 @@ GEM
|
|
39
39
|
addressable (2.3.8)
|
40
40
|
arel (6.0.0)
|
41
41
|
builder (3.2.2)
|
42
|
+
cookiejar (0.3.2)
|
42
43
|
descendants_tracker (0.0.4)
|
43
44
|
thread_safe (~> 0.3, >= 0.3.1)
|
44
45
|
docile (1.1.5)
|
@@ -148,6 +149,7 @@ PLATFORMS
|
|
148
149
|
DEPENDENCIES
|
149
150
|
addressable
|
150
151
|
bundler (~> 1.0)
|
152
|
+
cookiejar (~> 0.3.2)
|
151
153
|
jeweler (~> 2.0.1)
|
152
154
|
rack
|
153
155
|
rack-proxy
|
data/README.md
CHANGED
@@ -1,11 +1,69 @@
|
|
1
1
|
# rails-reverse-proxy
|
2
2
|
|
3
|
+
Gives you the ability to reverse proxy within Rails.
|
4
|
+
|
3
5
|
## Installation
|
4
6
|
|
7
|
+
You know the drill. In your Gemfile, have the line
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'rails-reverse-proxy'
|
11
|
+
```
|
12
|
+
|
13
|
+
Then (you guessed it!)
|
14
|
+
|
15
|
+
```
|
16
|
+
$ bundle
|
17
|
+
```
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
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
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
class WordpressController < ApplicationController
|
25
|
+
include ReverseProxy::Controller
|
26
|
+
|
27
|
+
def index
|
28
|
+
# Assuming the WordPress server is being hosted on port 8080
|
29
|
+
reverse_proxy "http://localhost:8080" do |config|
|
30
|
+
# We got a 404!
|
31
|
+
config.on_missing do |code, response|
|
32
|
+
redirect_to root_url and return
|
33
|
+
end
|
34
|
+
|
35
|
+
# There's also other callbacks:
|
36
|
+
# - on_set_cookies
|
37
|
+
# - on_response
|
38
|
+
# - on_set_cookies
|
39
|
+
# - on_success
|
40
|
+
# - on_redirect
|
41
|
+
# - on_missing
|
42
|
+
# - on_error
|
43
|
+
# - on_complete
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
```
|
48
|
+
|
49
|
+
Then in your `routes.rb` file, you should have something like
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
match 'blog/*path' => 'wordpress#index', via: [:get, :post, :put, :patch, :delete]
|
5
53
|
```
|
6
|
-
|
54
|
+
|
55
|
+
You can also pass options into `reverse_proxy`
|
56
|
+
|
57
|
+
```ruby
|
58
|
+
reverse_proxy "http://localhost:8000", path: "custom-path", headers: { 'X-Foo' => "Bar" }
|
7
59
|
```
|
8
60
|
|
61
|
+
Sorry if these instructions are sparse. Feel free to reach out or read the source!
|
62
|
+
|
63
|
+
## Contributing
|
64
|
+
|
65
|
+
All pull requests will become first class citizens.
|
66
|
+
|
9
67
|
## Copyright
|
10
68
|
|
11
69
|
Copyright (c) 2015 James Hu. See LICENSE.txt for
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.4.0
|
data/rails-reverse-proxy.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "rails-reverse-proxy"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.4.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["James Hu"]
|
@@ -45,6 +45,7 @@ Gem::Specification.new do |s|
|
|
45
45
|
s.add_runtime_dependency(%q<rack>, [">= 0"])
|
46
46
|
s.add_runtime_dependency(%q<rack-proxy>, [">= 0"])
|
47
47
|
s.add_runtime_dependency(%q<addressable>, [">= 0"])
|
48
|
+
s.add_runtime_dependency(%q<cookiejar>, ["~> 0.3.2"])
|
48
49
|
s.add_development_dependency(%q<shoulda>, [">= 0"])
|
49
50
|
s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
|
50
51
|
s.add_development_dependency(%q<bundler>, ["~> 1.0"])
|
@@ -55,6 +56,7 @@ Gem::Specification.new do |s|
|
|
55
56
|
s.add_dependency(%q<rack>, [">= 0"])
|
56
57
|
s.add_dependency(%q<rack-proxy>, [">= 0"])
|
57
58
|
s.add_dependency(%q<addressable>, [">= 0"])
|
59
|
+
s.add_dependency(%q<cookiejar>, ["~> 0.3.2"])
|
58
60
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
59
61
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
60
62
|
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
@@ -66,6 +68,7 @@ Gem::Specification.new do |s|
|
|
66
68
|
s.add_dependency(%q<rack>, [">= 0"])
|
67
69
|
s.add_dependency(%q<rack-proxy>, [">= 0"])
|
68
70
|
s.add_dependency(%q<addressable>, [">= 0"])
|
71
|
+
s.add_dependency(%q<cookiejar>, ["~> 0.3.2"])
|
69
72
|
s.add_dependency(%q<shoulda>, [">= 0"])
|
70
73
|
s.add_dependency(%q<rdoc>, ["~> 3.12"])
|
71
74
|
s.add_dependency(%q<bundler>, ["~> 1.0"])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails-reverse-proxy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Hu
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: cookiejar
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ~>
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.3.2
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ~>
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.3.2
|
69
83
|
- !ruby/object:Gem::Dependency
|
70
84
|
name: shoulda
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|