Sha256: 49765ff33065e0ae4f571576ff6e8ca3d5fdb3236e4137325b379f91fc935bf3

Contents?: true

Size: 298 Bytes

Versions: 21

Compression:

Stored size: 298 Bytes

Contents

class WwwMiddleware
  def initialize(app)
    @app = app
  end

  def call(env)
    request = Rack::Request.new(env)
    if request.host.starts_with?("www.")
      [301, {"Location" => request.url.sub("//www.", "//")}, self]
    else
      @app.call(env)
    end
  end

  def each(&block)
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
bootstripe-0.2.23 lib/bootstripe/www_middleware.rb
bootstripe-0.2.22 lib/bootstripe/www_middleware.rb
bootstripe-0.2.20 lib/bootstripe/www_middleware.rb
bootstripe-0.2.19 lib/bootstripe/www_middleware.rb
bootstripe-0.2.18 lib/bootstripe/www_middleware.rb
bootstripe-0.2.17 lib/bootstripe/www_middleware.rb
bootstripe-0.2.16 lib/bootstripe/www_middleware.rb
bootstripe-0.2.15 lib/bootstripe/www_middleware.rb
bootstripe-0.2.14 lib/bootstripe/www_middleware.rb
bootstripe-0.2.13 lib/bootstripe/www_middleware.rb
bootstripe-0.2.12 lib/bootstripe/www_middleware.rb
bootstripe-0.2.11 lib/bootstripe/www_middleware.rb
bootstripe-0.2.10 lib/bootstripe/www_middleware.rb
bootstripe-0.2.9 lib/bootstripe/www_middleware.rb
bootstripe-0.2.8 lib/bootstripe/www_middleware.rb
bootstripe-0.2.7 lib/bootstripe/www_middleware.rb
bootstripe-0.2.6 lib/bootstripe/www_middleware.rb
bootstripe-0.2.5 lib/bootstripe/www_middleware.rb
bootstripe-0.2.4 lib/bootstripe/www_middleware.rb
bootstripe-0.2.3 lib/bootstripe/www_middleware.rb