{"id":13825784,"url":"https://github.com/axsuul/rails-reverse-proxy","last_synced_at":"2025-05-16T03:02:06.091Z","repository":{"id":33262590,"uuid":"36907073","full_name":"axsuul/rails-reverse-proxy","owner":"axsuul","description":"A reverse proxy for Ruby on Rails","archived":false,"fork":false,"pushed_at":"2024-03-28T17:29:49.000Z","size":63,"stargazers_count":243,"open_issues_count":17,"forks_count":61,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-11T06:37:55.471Z","etag":null,"topics":["gem","networking","rails","reverse-proxy"],"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/axsuul.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2015-06-05T02:20:59.000Z","updated_at":"2025-05-05T02:05:31.000Z","dependencies_parsed_at":"2024-01-07T22:48:46.536Z","dependency_job_id":"4bfa8044-316c-40b4-bfe0-ee189cde24b5","html_url":"https://github.com/axsuul/rails-reverse-proxy","commit_stats":{"total_commits":99,"total_committers":12,"mean_commits":8.25,"dds":0.1717171717171717,"last_synced_commit":"b5156fa170b5634e1ece863686afac6fb60bdfcf"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axsuul%2Frails-reverse-proxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axsuul%2Frails-reverse-proxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axsuul%2Frails-reverse-proxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/axsuul%2Frails-reverse-proxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/axsuul","download_url":"https://codeload.github.com/axsuul/rails-reverse-proxy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254459077,"owners_count":22074604,"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","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":["gem","networking","rails","reverse-proxy"],"created_at":"2024-08-04T09:01:27.024Z","updated_at":"2025-05-16T03:02:06.074Z","avatar_url":"https://github.com/axsuul.png","language":"Ruby","funding_links":[],"categories":["\u003ca id=\"01e6651181d405ecdcd92a452989e7e0\"\u003e\u003c/a\u003e工具","Ruby"],"sub_categories":["\u003ca id=\"e9f97504fbd14c8bb4154bd0680e9e62\"\u003e\u003c/a\u003e反向代理"],"readme":"# rails-reverse-proxy\n\nA reverse proxy for Ruby on Rails.\n\n*A reverse proxy accepts a request from a client, forwards it to a server that can fulfill it, and returns the server's response to the client*\n\n## Installation\n\nYou know the drill. In your Gemfile\n\n```ruby\ngem 'rails-reverse-proxy'\n```\n\nThen (you guessed it!)\n\n```\n$ bundle install\n```\n\n## Usage\n\nA use case for this gem is serving WordPress on a path within your Rails application, such as `/blog`. \n\nTo do this, your controller might look like this\n\n```ruby\nclass WordpressController \u003c ApplicationController\n  include ReverseProxy::Controller\n\n  def index\n    # Assuming the WordPress server is being hosted on port 8080\n    reverse_proxy \"http://localhost:8080\" do |config|\n      # We got a 404!\n      config.on_missing do |code, response|\n        redirect_to root_url and return\n      end\n\n      # There's also other callbacks:\n      # - on_set_cookies\n      # - on_connect\n      # - on_response\n      # - on_set_cookies\n      # - on_success\n      # - on_redirect\n      # - on_missing\n      # - on_error\n      # - on_complete\n    end\n  end\nend\n```\n\nThen in your `routes.rb` file, you should have something like\n\n```ruby\nmatch 'blog/*path' =\u003e 'wordpress#index', via: [:get, :post, :put, :patch, :delete]\n```\n\nYou can also pass options into `reverse_proxy`\n\n```ruby\nreverse_proxy \"http://localhost:8000\", path: \"custom-path\", headers: { 'X-Foo' =\u003e \"Bar\" }\n```\n\nIf you'd like to bypass SSL verification\n\n```ruby\nreverse_proxy \"http://localhost:8000\", verify_ssl: false\n```\n\nIf you'd like to customize options passed into the underlying [`Net:HTTP`](https://ruby-doc.org/stdlib-2.4.0/libdoc/net/http/rdoc/Net/HTTP.html#start-method) object\n\n```ruby\nreverse_proxy \"http://localhost:8000\", http: { read_timeout: 20, open_timeout: 100 }\n```\n\nIf you'd like to reset the `Accept-Encoding` header in order to disable compression or other server-side encodings\n\n```ruby\nreverse_proxy \"http://localhost:8000\", reset_accept_encoding: true\n```\n\nDetermine what version you're using\n\n```ruby\nReverseProxy.version\n```\n\nFeel free to open an issue!\n\n## Contributing\n\nAll pull requests will become first class citizens.\n\n## Contributors\n\nSpecial thanks to our contributors! \n\n- [aardvarkk](https://github.com/aardvarkk)\n- [Arjeno](https://github.com/Arjeno)\n- [avinashkoulavkar](https://github.com/avinashkoulavkar)\n- [bapirex](https://github.com/bapirex)\n- [davidrunger](https://github.com/davidrunger)\n- [jcs](https://github.com/jcs)\n- [kylewlacy](https://github.com/kylewlacy)\n- [marcosbeirigo](https://github.com/marcosbeirigo)\n- [mediafinger](https://github.com/mediafinger)\n- [miyukki](https://github.com/miyukki)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxsuul%2Frails-reverse-proxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faxsuul%2Frails-reverse-proxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faxsuul%2Frails-reverse-proxy/lists"}