-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathconfig.ru
36 lines (30 loc) · 1.35 KB
/
config.ru
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Encoding.default_internal = Encoding::UTF_8
require 'bundler/setup'
require 'rack/contrib/try_static'
require 'rack/contrib/not_found'
require 'rack/rewrite'
use Rack::Deflater
Bundler.require(:default)
# Testing these rules
use Rack::Rewrite do
r301 /(.*)\/index\.html$/i, 'http://www.neverstopbuilding.com$1'
r301 /building-a-gqueues-dashboard-widget/i, 'http://www.neverstopbuilding.com'
r301 /ranting-about-resumes-jason-toots-his-own-horn/i, 'http://www.neverstopbuilding.com/resume-story'
r301 /.*/, 'http://www.neverstopbuilding.com$&', if: proc { |rack_env| rack_env['SERVER_NAME'] != 'www.neverstopbuilding.com' }
r301 /category\/robo-garden/i, 'http://www.neverstopbuilding.com/project/robo-garden'
r301 /category\/?$/i, 'http://www.neverstopbuilding.com/archive'
end
use Rack::TryStatic,
urls: %w[/],
root: 'build/deploy',
try: ['index.html', '/index.html'],
header_rules: [
['atom.xml', { 'Content-Type' => 'application/atom+xml' }],
[['xml'], { 'Content-Type' => 'application/xml' }],
[['html'], { 'Content-Type' => 'text/html; charset=utf-8' }],
[['css'], { 'Content-Type' => 'text/css' }],
[['js'], { 'Content-Type' => 'text/javascript' }],
[['png'], { 'Content-Type' => 'image/png' }],
['/assets', { 'Cache-Control' => 'public, max-age=31536000' }],
]
run Rack::NotFound.new('build/deploy/404.html')