rails_multisite 2.3.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of rails_multisite might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/README.md +13 -0
- data/lib/rails_multisite/connection_management.rb +16 -1
- data/lib/rails_multisite/version.rb +1 -1
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c423a9ad1f1506b7278fdad487f740236f6241a5cfced260e135cc4392f0f24d
|
4
|
+
data.tar.gz: 3da1e820fedb5a8ec1c7c34c41668cf62d8891bab765f554e54186688fe27464
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 68717b4c14ccf6586de353e1e455aa948e931a498fcb5816008f5f6655e6d8c896793ef635532cc056073f917f7ea6e7205e7f5bc9b4a5a581e574cee76cd47b
|
7
|
+
data.tar.gz: 68779aedd6acb814e8401226ef67ad9636abf3ca71c954cef89226199fd754a34f78c84c5340af2bc2216f9e560d410867837a3fd3d221c53b08449ed60ceb68
|
data/README.md
CHANGED
@@ -93,6 +93,19 @@ To get a Rails console that is connected to `some_database_1` database:
|
|
93
93
|
RAILS_DB=db_one rails console
|
94
94
|
```
|
95
95
|
|
96
|
+
### CDN origin support
|
97
|
+
|
98
|
+
To avoid needing to configure many origins you can consider using `RailsMultisite::ConnectionManagement.asset_hostname`
|
99
|
+
|
100
|
+
When configured, requests to `asset_hostname`?__ws=another.host.name will be re-routed to the correct site. Cookies will
|
101
|
+
be stripped on all incoming requests.
|
102
|
+
|
103
|
+
Example:
|
104
|
+
|
105
|
+
- Multisite serves `sub.example.com` and `assets.example.com`
|
106
|
+
- `RailsMultisite::ConnectionManagement.asset_hostname = 'assets.example.com'`
|
107
|
+
- Requests to `https://assets.example.com/route/?__ws=sub.example.com` will be routed to the `sub.example.com`
|
108
|
+
|
96
109
|
|
97
110
|
## Contributing
|
98
111
|
|
@@ -35,6 +35,14 @@ module RailsMultisite
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
+
def self.asset_hostname
|
39
|
+
@asset_hostname
|
40
|
+
end
|
41
|
+
|
42
|
+
def self.asset_hostname=(h)
|
43
|
+
@asset_hostname = h
|
44
|
+
end
|
45
|
+
|
38
46
|
def self.config_filename
|
39
47
|
@instance.config_filename
|
40
48
|
end
|
@@ -370,7 +378,14 @@ module RailsMultisite
|
|
370
378
|
end
|
371
379
|
|
372
380
|
request = Rack::Request.new(env)
|
373
|
-
|
381
|
+
|
382
|
+
host =
|
383
|
+
if request['__ws'] && request.host == self.class.asset_hostname
|
384
|
+
request.cookies.clear
|
385
|
+
request['__ws']
|
386
|
+
else
|
387
|
+
request.host
|
388
|
+
end
|
374
389
|
|
375
390
|
env["RAILS_MULTISITE_HOST"] = host
|
376
391
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rails_multisite
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Saffron
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -70,7 +70,7 @@ files:
|
|
70
70
|
homepage: ''
|
71
71
|
licenses: []
|
72
72
|
metadata: {}
|
73
|
-
post_install_message:
|
73
|
+
post_install_message:
|
74
74
|
rdoc_options: []
|
75
75
|
require_paths:
|
76
76
|
- lib
|
@@ -85,8 +85,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
85
85
|
- !ruby/object:Gem::Version
|
86
86
|
version: '0'
|
87
87
|
requirements: []
|
88
|
-
rubygems_version: 3.
|
89
|
-
signing_key:
|
88
|
+
rubygems_version: 3.0.3
|
89
|
+
signing_key:
|
90
90
|
specification_version: 4
|
91
91
|
summary: Multi tenancy support for Rails
|
92
92
|
test_files: []
|