seo_cache 0.9.0 → 0.10.0

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
  SHA256:
3
- metadata.gz: e101c3d2b9260ac681e1d6ffc399c88e98c5f1edc69f3148790e6b63abda2ad0
4
- data.tar.gz: de86f2455bb55ecbbf70365c068f6ba3b4f865cb59dfb352975a6f14d4599681
3
+ metadata.gz: 4ff4b04ea72963e8609ce8ebc7ddd53e4c2f05087f80f13363f4810bc2a0f46f
4
+ data.tar.gz: 8072db1df79a2a2a530815fe6054fd40f3abbd162b782de2304f6af7ada944d1
5
5
  SHA512:
6
- metadata.gz: 2539f235f5e806422cbd969723a3a83cb671b270869ec02f73efffa2d15f96bf401155bcc48ea462ad1ee7fac2b994692b94103decd33ec61f5ee88672c5ad16
7
- data.tar.gz: d871e975c11792c10bde694427e184e19d1b7effa0ff5eb90bd88daa05ed1b42a66deccbe111e2435fb0972df24556a88c462956eb47f59d4c1875fe94e66be2
6
+ metadata.gz: 64088bbe57c6e6859ba0c0b578112b52bfeffd6b2f64f9cef2f88a63c946bfb27183f94245fe4ed8bba37731fde0cebc19a783972cb92ac0692927b8d6bc7a23
7
+ data.tar.gz: 1ac9cbe9ee21dbeee0a675f88799c48bdc23b85b6296d9e971b954204ad03aac5116b653095ec0a70481e1f579be138e8bb659f37d12fdc3c710978f3887ae62
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## 0.9.0
2
2
 
3
+ - Update Readme for nginx configuration
4
+
5
+ ## 0.9.0
6
+
3
7
  - Update gems
4
8
  - Don't cache response if status is not 200
5
9
  - Add 'seo_mode' variable to env to detect si seo mode is currently active
data/README.md CHANGED
@@ -186,6 +186,33 @@ You can add the `force_cache: true` option to `SeoCache::PopulateCache` for over
186
186
  If you use disk caching, add to your Nginx configuration:
187
187
 
188
188
  ```nginx
189
+ # Before any block:
190
+ map $http_user_agent $limit_bots {
191
+ default 0;
192
+ ~*(google|bing|yandex|msnbot) 1;
193
+ }
194
+
195
+ map $request_method $is_get {
196
+ default 0;
197
+ GET 1;
198
+ }
199
+
200
+ # Before location block:
201
+ set $bot_request '';
202
+ if ($is_get) {
203
+ set $bot_request 'GET_';
204
+ }
205
+
206
+ if ($limit_bots) {
207
+ set $bot_request "${bot_request}BOT";
208
+ }
209
+
210
+ set $cache_extension '';
211
+ if ($bot_request = GET_BOT) {
212
+ set $cache_extension '.html';
213
+ }
214
+
215
+ # Inside location block:
189
216
  location / {
190
217
  # Ignore url with blacklisted params (e.g. page)
191
218
  if ($arg_page) {
@@ -195,29 +222,16 @@ location / {
195
222
  break;
196
223
  }
197
224
 
198
- # cached pages
199
- set $cache_extension '';
200
- if ($request_method = GET) {
201
- set $cache_extension '.html';
202
- }
203
-
204
- # Index HTML Files
205
- if (-f $document_root/seo_cache/$uri/index$cache_extension) {
206
- rewrite (.*) /seo_cache/$1/index.html break;
207
- }
208
-
209
- # Other HTML Files
210
- if (-f $document_root/seo_cache/$uri$cache_extension) {
211
- rewrite (.*) /seo_cache/$1.html break;
212
- }
213
-
214
- # All
215
- if (-f $document_root/seo_cache/$uri) {
216
- rewrite (.*) /seo_cache/$1 break;
217
- }
225
+ try_files /seo_cache/$uri/index$cache_extension /seo_cache/$uri$cache_extension /seo_cache/$uri $uri @rubyproxy;
226
+ }
227
+
228
+ location @rubyproxy {
229
+ ...
218
230
  }
219
231
  ```
220
232
 
233
+ This configuration allow you to use SEO cache only for bots (you can add other bots) and GET requests. For users, you don't want to use the cached page (user connection, basket, ...). The performance are less important for users then bots.
234
+
221
235
  ## Heroku case
222
236
 
223
237
  If you use Heroku server, you can't store file on dynos. But you have two alternatives :
@@ -1,3 +1,3 @@
1
1
  module SeoCache
2
- VERSION = '0.9.0'.freeze
2
+ VERSION = '0.10.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: seo_cache
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - FloXcoder
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-09-23 00:00:00.000000000 Z
11
+ date: 2019-10-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport