jaswope / rack-reverse-proxy Goto Github PK
View Code? Open in Web Editor NEWA Reverse Proxy for Rack
Home Page: http://github.com/jaswope/rack-reverse-proxy
License: MIT License
A Reverse Proxy for Rack
Home Page: http://github.com/jaswope/rack-reverse-proxy
License: MIT License
Right now, a PATCH request gives you "method not supported: PATCH"
Guys,
this is small cool project yet current maintainer clearly has no time/will to maintain it.
Is there someone better suited for the job who would like to take over?
If not, I'd be happy to help as it looks like I'll be using this library more and more in upcoming months.
Hi,
I have reverse proxy setup for a subfolder to a wordpress blog, which is hosted on an ec2 server. Ultimate goal "https://www.example.com/blog/" The problem is the parent site is in https, so for transparency I've added openssl to the lamp stack(ec2). The problem is that the wordpress blog is not showing any assets/css.
routes:
#wordpress
match "/blog" => redirect("/blog/")
config.ru
use Rack::ReverseProxy do
reverse_proxy /^/blog(/.*)$/, 'http://xx.xx.xx.x$1', opts={:preserve_host => true}
end
xx.xx.xx.x = ip to the ec2 box with wordpress installed.
Thank you for this great gem.
I would like to show the contents from a URL with subdirectory at the http://example.com/ (Rails app).
I configured config/application.rb as following, but this does not work.
module MyRailsApp
class Application < Rails::Application
config.middleware.use Rack::ReverseProxy do
reverse_proxy_options preserve_host: true
reverse_proxy /^\/$/, 'http://example-2.com/example-page'
end
end
end
But this configuration only shows "http://example-2.com/" not "http://example-2.com/example-page”.
Is this usage supported?
Just wondering if this gem could be used as a development/test load balancer that a dev could run locally. I was looking for a simple way to start two http apps and just have this toggle between the two when http requests come in.
I have setup a rake task to refresh the sitemap of an application, and it's hosted in S3, because we're using heroku. Can I use this to reverse proxy in this case? I tried but I get an error
<Error>
<Code>InvalidArgument</Code>
<Message>Unsupported Authorization Type</Message>
<ArgumentName>Authorization</ArgumentName>
This seems to only preserve the request body on PUT and POST request methods. AFAIK, the standards do not explicitly prohibit a request body on a DELETE request, so the reverse proxy shouldn't either.
Hello,
my old API website requires http basic auth (or oauth) in order for a user to gain access to the page.
In my new Rails app I mounted rack-reverse-proxy but I'd like to know if it's possible to also forward the custom user/password combo the user is asking my app.
Is that possible?
I have a domain "https://www.example.com".
I've setup my config.ru to do the simple forward shown in the wiki
reverse_proxy /^\/blog(\/*.*)$/, 'http://myblog.tumblr.com$1'
However, when I try to visit "https://www.example.com/blog", it redirects to "https://www.tumblr.com". Is this expected?
I had to create a reverse proxy for encoded_uri
in this URL:
/proxy?url=encoded_uri
The configuration of the proxy:
reverse_proxy /^\/proxy\?url=(.*)$/, "$1", :preserve_host => false
The problem is that the implementation of get_uri doesnt take into account the URL encoding of the parameter and it returns:
https%3A%2F%2Fgithub.com%2Fjaswope%2Frack-reverse-proxy%2Fissues%2Fnew
which causes an internal server error.
My fix:
class Rack::ReverseProxyMatcher alias_method :get_uri_without_decode, :get_uri def get_uri(path,env) puts 'this is a monkeypatched method for :get_uri' url = get_uri_without_decode(path,env) if url.path.start_with?('http%') url = URI.decode url.path url = URI(url) end url end end
:preserve_host, when set to true, causes the Host header to be overridden, not to be preserved, unlike Apache's ProxyPreserveHost, which has the semantics you would expect.
In other words, given Rack app A reverse-proxying to B, with :preserve_host => false, it will send "Host: A", and with :preserve_host => true, it will send "Host: B".
It should be the other way around, i.e. false sends B and true sends A, so that the option means what it says, and to be consistent with Apache.
The default should probably be to not preserve the host, like Apache. (I'm not sure about the current default...)
Here's my config in config/production.rb:
https://gist.github.com/3786109
Heroku logs output:
https://gist.github.com/3786102
Went off this blog post:
http://bindle.me/blog/index.php/304/rack-middleware-for-seo-fun-and-profit
I realize I didn't use the RegEx, but I got a similar result when I did.
thank you!
Hi, I'm using this project to redirect requests in an existing heroku app that has been moved to a more powerful cluster.
Redirects occur fine but I need one of the headers that the devices are sending to heroku, to be sent to the cluster where the proxy is pointing at.
(I'm not a ruby dev so please bear with me)
config.ru (if it helps)
require 'rack/reverse_proxy'
use Rack::ReverseProxy do
reverse_proxy_options :preserve_host => true
reverse_proxy '/', 'http://example.com'
end
app = proc do |env|
[ 200, {'Content-Type' => 'application/json'}, "b" ]
end
run app
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.