Sha256: 392b7694d2973aeaa38b411f7f0f566d4ecc1286cb110180de59aeb29dd39a5c
Contents?: true
Size: 419 Bytes
Versions: 1
Compression:
Stored size: 419 Bytes
Contents
class WithOrWithoutWWW def initialize(app, with=true) @app, @with = app, with end def call(env) req = Rack::Request.new(env) if !@with && req.host[/^www./] [301, {"Location" => req.url.sub("//www.", "//")}, self] elsif @with && !req.host[/^www./] [301, {"Location" => req.url.sub("//", "//www.")}, self] else @app.call(env) end end def each(&block); end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
with-or-without-www-0.0.1 | with_or_without_www.rb |