Sha256: ce6eb8b79ebb01b6b9b629429a46952d91f8d646533c8876fa615e1d91111d1d

Contents?: true

Size: 633 Bytes

Versions: 1

Compression:

Stored size: 633 Bytes

Contents

module HashiCorp
  module Rack
    # This redirects the V1 docs to the GitHub pages hosted version.
    class RedirectV1Docs
      def initialize(app)
        @app = app
      end

      def call(env)
        if env["PATH_INFO"] =~ /^\/v1/
          headers = {
            "Content-Type" => "text/html",
            "Location"     => "http://docs-v1.vagrantup.com#{env["PATH_INFO"]}",
            "Surrogate-Key" => "page"
          }

          message = "Redirecting to old documentation URL..."

          return [301, headers, [message]]
        end

        @app.call(env)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-cloudstack-1.2.0 vendor/bundle/bundler/gems/vagrant-c84e05fd063f/website/docs/lib/redirect_v1_docs.rb