Skip to content

Instantly share code, notes, and snippets.

@MichalPekala
Created September 27, 2012 12:24
Show Gist options
  • Select an option

  • Save MichalPekala/3793722 to your computer and use it in GitHub Desktop.

Select an option

Save MichalPekala/3793722 to your computer and use it in GitHub Desktop.

Revisions

  1. MichalPekala revised this gist Sep 27, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion proxy.ru
    Original file line number Diff line number Diff line change
    @@ -1,5 +1,5 @@
    require 'rubygems'
    require "rack/streaming_proxy"
    require 'rack/streaming_proxy'

    use Rack::Auth::Basic, "Restricted Area" do |username, password|
    [username, password] == ['user', 'password']
  2. MichalPekala created this gist Sep 27, 2012.
    14 changes: 14 additions & 0 deletions proxy.ru
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    require 'rubygems'
    require "rack/streaming_proxy"

    use Rack::Auth::Basic, "Restricted Area" do |username, password|
    [username, password] == ['user', 'password']
    end

    use Rack::StreamingProxy do |request|
    if request.path.start_with?("/proxy")
    "http://other.host#{request.path}"
    end
    end

    run proc{|env| [200, {"Content-Type" => "text/plain"}, ["Running..."]] }