{"id":17924993,"url":"https://github.com/zerowidth/rack-streaming-proxy","last_synced_at":"2025-07-23T05:37:34.149Z","repository":{"id":56890276,"uuid":"373183","full_name":"zerowidth/rack-streaming-proxy","owner":"zerowidth","description":"Streaming proxy for Rack, the rainbows to Rack::Proxy's unicorn","archived":false,"fork":false,"pushed_at":"2017-01-25T01:53:37.000Z","size":96,"stargazers_count":91,"open_issues_count":6,"forks_count":30,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-07-14T12:49:40.015Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zerowidth.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-11-14T22:28:28.000Z","updated_at":"2023-02-02T09:29:45.000Z","dependencies_parsed_at":"2022-08-20T16:00:51.940Z","dependency_job_id":null,"html_url":"https://github.com/zerowidth/rack-streaming-proxy","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/zerowidth/rack-streaming-proxy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerowidth%2Frack-streaming-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerowidth%2Frack-streaming-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerowidth%2Frack-streaming-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerowidth%2Frack-streaming-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zerowidth","download_url":"https://codeload.github.com/zerowidth/rack-streaming-proxy/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zerowidth%2Frack-streaming-proxy/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266625184,"owners_count":23958304,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-23T02:00:09.312Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-28T20:51:52.175Z","updated_at":"2025-07-23T05:37:34.125Z","avatar_url":"https://github.com/zerowidth.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rack::StreamingProxy\n\nA transparent streaming proxy to be used as rack middleware.\n\n* Streams the response from the downstream server to minimize memory usage\n* Handles chunked encoding if used\n* Proxies GET/PUT/POST/DELETE, XHR, and cookies\n\nNow updated to be compatible with Rails 3 and 4, and fixes major concurrency issues that were present in 1.0.\n\nUse Rack::StreamingProxy when you need to have the response streamed back to the client, for example when handling large file requests that could be proxied directly but need to be authenticated against the rest of your middleware stack.\n\nNote that this will not work well with EventMachine. EM buffers the entire rack response before sending it to the client. When testing, try Unicorn or Passenger rather than the EM-based Thin (See [discussion](http://groups.google.com/group/thin-ruby/browse_thread/thread/4762f8f851b965f6)).\n\nA simple streamer app has been included for testing and development.\n\n## Usage\n\nTo use inside a Rails app, add a `config/initializers/streaming_proxy.rb` initialization file, and place in it:\n\n```ruby\nrequire 'rack/streaming_proxy'\n\nYourRailsApp::Application.configure do\n  config.streaming_proxy.logger             = Rails.logger                          # stdout by default\n  config.streaming_proxy.log_verbosity      = Rails.env.production? ? :low : :high  # :low or :high, :low by default\n  config.streaming_proxy.num_retries_on_5xx = 5                                     # 0 by default\n  config.streaming_proxy.raise_on_5xx       = true                                  # false by default\n\n  # Will be inserted at the end of the middleware stack by default.\n  config.middleware.use Rack::StreamingProxy::Proxy do |request|\n\n    # Inside the request block, return the full URI to redirect the request to,\n    # or nil/false if the request should continue on down the middleware stack.\n    if request.path.start_with?('/search')\n      \"http://www.some-other-service.com/search?#{request.query}\"\n    end\n  end\nend\n```\n\nTo use as a Rack app:\n\n```ruby\nrequire 'rack/streaming_proxy'\n\nuse Rack::StreamingProxy::Proxy do |request|\n  if request.path.start_with?('/proxy')\n    # You probably want to get rid of the '/proxy' in the path, when requesting from the destination.\n    proxy_path = request.path.sub %r{^/proxy}, ''\n    \"http://www.another-server.com#{proxy_path}\"\n  end\nend\n```\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'rack-streaming-proxy'\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install rack-streaming-proxy\n\n## Requirements\n\n* Ruby = 1.9.3\n* rack \u003e= 1.4\n* servolux ~\u003e 0.10\n\nThese requirements (other than Ruby) will be automatically installed via Bundler.\n\nThis gem has not been tested with versions lower than those indicated.\n\nThis gem works with Ubuntu 10.04. It has not been tested with later versions of Ubuntu or other Linuxes, but it should work just fine. It has not been tested with OS X but should work as well. However, I doubt it will work on any version of Windows, as it does process-based stuff. You are most welcome to try it and report back.\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Implement your changes, and make sure to add tests!\n4. Commit your changes (`git commit -am 'Add some feature'`)\n5. Push to the branch (`git push origin my-new-feature`)\n6. Create new Pull Request\n\n## Thanks To\n\n* [Nathan Witmer](http://github.com/zerowidth) for the 1.0 implementation of [Rack::StreamingProxy](http://github.com/zerowidth/rack-streaming-proxy)\n* [Tom Lea](http://github.com/cwninja) for [Rack::Proxy](http://gist.github.com/207938), which inspired Rack::StreamingProxy.\n* [Tim Pease](http://github.com/TwP) for [Servolux](https://github.com/Twp/servolux)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzerowidth%2Frack-streaming-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzerowidth%2Frack-streaming-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzerowidth%2Frack-streaming-proxy/lists"}