rails_multisite 2.3.0 → 2.4.0

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rails_multisite might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2acf52c9b8002bff6a1590222b85d778cb1ddd9e28de6ac91eed45d5117e30aa
4
- data.tar.gz: 3b39a8d9a2d2b70c62e29a0541d585c499a51cb9ac6b8dac2544343b1c22d45c
3
+ metadata.gz: c423a9ad1f1506b7278fdad487f740236f6241a5cfced260e135cc4392f0f24d
4
+ data.tar.gz: 3da1e820fedb5a8ec1c7c34c41668cf62d8891bab765f554e54186688fe27464
5
5
  SHA512:
6
- metadata.gz: f7b8775f143c21083b7141ca6592c5f8d75f12a287f14452a63ff159f0932c0fafe918256d8219431d9d3647b09b340daab747d5b0b10ff3e1c1b1c1f3eeab34
7
- data.tar.gz: 81abf0c622d83d541bb0870a7bc2cac379c137ae4057b11a44bc8ab8ff4a6be3e1b730420766b22a55ff3aa7505ef7e9e0ab5494c8c1bdedfc8444e862cf0af0
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
- host = request['__ws'] || request.host
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
  #
3
3
  module RailsMultisite
4
- VERSION = "2.3.0"
4
+ VERSION = "2.4.0"
5
5
  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.3.0
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-06-10 00:00:00.000000000 Z
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.1.2
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: []