这就是整个代码库:
use Rack::Static,
:urls => ["/images", "/js", "/css"],
:root => "public"
run lambda { |env|
[
200,
{
'Content-Type' => 'text/html',
'Cache-Control' => 'public, max-age=86400'
},
File.open('public/index.html', File::RDONLY)
]
}
答案 0 :(得分:0)
使用gem rack-ssl-enforcer
添加这些行,它将automatically从http直接导向https。
require 'rack/ssl-enforcer'
use Rack::SslEnforcer