hide_heroku 0.0.1
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.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +34 -0
- data/Rakefile +1 -0
- data/hide_heroku.gemspec +22 -0
- data/lib/.DS_Store +0 -0
- data/lib/hide_heroku.rb +5 -0
- data/lib/hide_heroku/railtie.rb +13 -0
- data/lib/rack/hide_heroku.rb +27 -0
- metadata +83 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: fd40a4502aa04a0de8da37b94bffb55a500337ee
|
4
|
+
data.tar.gz: b80e8c73a7a3385247665722bcb4702f654168b9
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3de127572524078c2aa2fcf7f5cce9788b581bea4770fbf9e6650a44a4b9299db00c6fc98e22575726190cc9566cd7b8d92a56f7572b8e40f29841e7ad270a4c
|
7
|
+
data.tar.gz: 4e004f8620d8cda2f91b62b98054d58f85c2747f1f6be78bd0ae69d77fefb98e8cfed8c307abbd99078692a5f09d2f58718e49c62f2af8a05cdbfd8834f3d009
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2013 Yarin Kessler
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# Hide Heroku
|
2
|
+
|
3
|
+
Hides default Heroku (*.herokuapp.com) URLs from search engines in order to avoid duplicate content issues.
|
4
|
+
|
5
|
+
## Info
|
6
|
+
|
7
|
+
All Heroku apps are accessible via the `herokuapp.com`, even after a custom domain is assigned. This introduces the potential for duplicate content issues if search engines index the same content under both custom and default domains. A number of solutions can be employed to overcome this, including redirection and robots.txt files. However an easy and innocuous solution is to always issue an **X-Robots-Tag** response header with `noindex` and `nofollow` directives for any request against `.herokuapp.com`, thereby ensuring the most common search engines effectively ignore anything served under that domain.
|
8
|
+
|
9
|
+
- [Robots meta tag and X-Robots-Tag HTTP header specifications - Google Webmasters](https://developers.google.com/webmasters/control-crawl-index/docs/robots_meta_tag)
|
10
|
+
- [Preventing your site from being indexed, the right way • Yoast](http://yoast.com/prevent-site-being-indexed/)
|
11
|
+
- [Using the X-Robots-Tag HTTP Header Specifications in SEO: Tips and Tricks - SEO Chat](http://www.seochat.com/c/a/search-engine-optimization-help/using-the-x-robots-tag-http-header-specifications-in-seo-tips-and-tricks/)
|
12
|
+
|
13
|
+
|
14
|
+
## Installation
|
15
|
+
|
16
|
+
hide_heroku is Rack middleware that can be used with Rails or any other Rack application.
|
17
|
+
|
18
|
+
Add this line to your application's Gemfile:
|
19
|
+
|
20
|
+
gem 'hide_heroku'
|
21
|
+
|
22
|
+
And then execute:
|
23
|
+
|
24
|
+
$ bundle
|
25
|
+
|
26
|
+
Or install it yourself as:
|
27
|
+
|
28
|
+
$ gem install hide_heroku
|
29
|
+
|
30
|
+
For non-rails applications, add this line to the config.ru file:
|
31
|
+
|
32
|
+
use Rack::HideHeroku
|
33
|
+
|
34
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/hide_heroku.gemspec
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
Gem::Specification.new do |spec|
|
6
|
+
spec.name = "hide_heroku"
|
7
|
+
spec.version = "0.0.1"
|
8
|
+
spec.authors = ["Yarin Kessler"]
|
9
|
+
spec.email = ["ykessler@appgrinders.com"]
|
10
|
+
spec.description = "Hides default Heroku (*.herokuapp.com) URLs from search engines in order to avoid duplicate content issues"
|
11
|
+
spec.summary = "Hides default Heroku (*.herokuapp.com) URLs from search engines"
|
12
|
+
spec.homepage = "https://github.com/ykessler/hide-heroku"
|
13
|
+
spec.license = "MIT"
|
14
|
+
|
15
|
+
spec.files = `git ls-files`.split($/)
|
16
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
17
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
18
|
+
spec.require_paths = ["lib"]
|
19
|
+
|
20
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
21
|
+
spec.add_development_dependency "rake"
|
22
|
+
end
|
data/lib/.DS_Store
ADDED
Binary file
|
data/lib/hide_heroku.rb
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
|
2
|
+
module Rack
|
3
|
+
|
4
|
+
class HideHeroku
|
5
|
+
|
6
|
+
def initialize(app)
|
7
|
+
@app=app
|
8
|
+
end
|
9
|
+
|
10
|
+
def call(env)
|
11
|
+
@status, @headers, @response = @app.call(env)
|
12
|
+
@request = Rack::Request.new(env)
|
13
|
+
[@status, _apply_headers, @response]
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def _apply_headers
|
19
|
+
if /\.herokuapp\.com\/?.*/ =~ @request.url
|
20
|
+
@headers['X-Robots-Tag'] = 'noindex, nofollow'
|
21
|
+
end
|
22
|
+
@headers
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: hide_heroku
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Yarin Kessler
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-09-28 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: Hides default Heroku (*.herokuapp.com) URLs from search engines in order
|
42
|
+
to avoid duplicate content issues
|
43
|
+
email:
|
44
|
+
- ykessler@appgrinders.com
|
45
|
+
executables: []
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- .gitignore
|
50
|
+
- Gemfile
|
51
|
+
- LICENSE.txt
|
52
|
+
- README.md
|
53
|
+
- Rakefile
|
54
|
+
- hide_heroku.gemspec
|
55
|
+
- lib/.DS_Store
|
56
|
+
- lib/hide_heroku.rb
|
57
|
+
- lib/hide_heroku/railtie.rb
|
58
|
+
- lib/rack/hide_heroku.rb
|
59
|
+
homepage: https://github.com/ykessler/hide-heroku
|
60
|
+
licenses:
|
61
|
+
- MIT
|
62
|
+
metadata: {}
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
requirements: []
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.0.3
|
80
|
+
signing_key:
|
81
|
+
specification_version: 4
|
82
|
+
summary: Hides default Heroku (*.herokuapp.com) URLs from search engines
|
83
|
+
test_files: []
|