Rack provides a minimal, modular, and adaptable interface for developing web applications in Ruby.
Questions tagged [rack-middleware]
66 questions
3
votes
1 answer
rack-rewrite with Rails 3.2.3 on Heroku
I'm trying to set up rack-rewrite for a Rails 3.2.3 on Heroku cedar stack and everywhere I look it says to add something like:
config.middleware.insert_before(Rack::Lock, Rack::Rewrite) do
# rewrite rules
end
But trying to run this on Heroku…

Oded
- 233
- 2
- 9
2
votes
1 answer
How to access ExceptionNotifier variables
How can I access ExceptionNotifier variables such as sender_address or exception_recipients in my custom mailer class? Since ExceptionNotifier is implemented as Rack middleware, I'm not sure how to go about it.

Alex Korban
- 14,916
- 5
- 44
- 55
2
votes
1 answer
Is it possible to include an unbuilt Rails Engine without using the Gemfile?
This may be a bit of a contrived question, but I'm working on a Rails API and want to keep the API middleware stack minimal, while providing an OAuth endpoint that requires a few of the more complex middlewares. My thought was to make it into an…

mltsy
- 6,598
- 3
- 38
- 51
2
votes
1 answer
Apartment current_tenant resets to 'public' after failed devise login
I use Devise for authentication and Apartment for multi-tenancy support on a SAAS app.
After a failed login, devise "redirects" to the login page (Users::SessionsController#new) and the value of Apartment::Tenant.current which was previously set in…

Favourite Onwuemene
- 4,247
- 8
- 28
- 46
2
votes
2 answers
rack-attack doesn't blacklists any ip
Its my first interaction with rack-attack so please feel free to point out any mistakes I might have in the code.
what I am trying is to blacklist those ip which are trying to access routes like "/azenv.php", "/setup.php" etc.. As these people are…

Abhinay
- 1,796
- 4
- 28
- 52
2
votes
1 answer
Building Rack Middleware responses with Flash message functionality
I have a Sinatra app that's mounted on a Rails app under /admin. The Sinatra app is an admin dashboard, and therefore should only be available to authorized users.
To enforce that, I built a piece of Rack Middleware that will run before the Sinatra…

user2490003
- 10,706
- 17
- 79
- 155
2
votes
2 answers
How to inject a Rack middleware into an existing Rack app?
Given a Rack app that is not Rails,
builder.rb:
def app
Rack::Builder.new{
use Rack::Static, urls:static_paths, root:'public'
run ThaApp
}.to_app
end
How to inject a testing middleware using the spec_helper?

B Seven
- 44,484
- 66
- 240
- 385
2
votes
1 answer
Exception_Notification is not aware of RecordNotFound exceptions
I'm trying to use exception_notification for the first time. I watched the Railscast and followed instructions from the author in http://smartinez87.github.io/exception_notification/. Everything seems to work fine with some sort of exceptions but…

Juanra
- 23
- 4
2
votes
0 answers
Is there a way to get session cookie name in rack middleware?
I use middleware class in Rack, Ruby on Rails and Sinatra applications.
Rack application
config.ru:
use Rack::Session::Cookie, key: '_dummy_session', secret: '...'
use MyMiddleware
run Dummy.new
Ruby on Rails…
user240748
2
votes
1 answer
Where to put the rack middleware file in rails 3?
I want to use this rack middleware in my rails app, followed every solutions on another SO post but still no luck, keep on getting uninitialized constant error.
So, what's the precise location to put the rack middleware file and include the…

shinnc
- 899
- 7
- 16
2
votes
0 answers
Route an error caused by middleware?
I have an app where I use the apartment gem, where I'm trying to route an error caused by the (apartment)middleware to a specific page and I have no clue how to solve this. I tried putting it into the controller, didn't help because it throws the…

ernesto50
- 131
- 1
- 3
- 11
1
vote
0 answers
Disabling Rails middleware for some actions but not all
It seems that ActionDispatch::ParamsParser is quite slow for some requests, in particular when there is a large JSON request body. I'd like to disable it for these requests, but for most of my application it works great. Is there a convenient way to…

lacker
- 5,470
- 6
- 36
- 38
1
vote
2 answers
Omniauth custom `callback_path` makes `env['omniauth.auth']` return nil. Tried few approaches fruitful to some extent but failing in the end
Background
My application requires me to connect to two different Facebook apps for different purposes and for which I am using below shown code.
Problem
When using a custom callback_path like in method facebook_opts_for_social_sharing shown below,…

Jignesh Gohel
- 6,236
- 6
- 53
- 89
1
vote
1 answer
PDFKit middleware problem on Rails 2.3.8
I have installed PDFKit and wkhtmltopdf on my Ubuntu 8.04 server. I am trying to use PDFKit as middleware in my Rails 2.3.8 app and have added the following lines to environment.rb (as directed on the jdpace pdfkit page):
require…

user441644
- 11
- 4
1
vote
0 answers
[Facebook][Canvas] Extract original request method
Short version
Is it somehow possible to get the original request method out of the POST request that Facebook is performing to my web application?
Long version
I want to make my current web applications Facebook canvas frame compatible at the lowest…

Jan Owiesniak
- 81
- 2
- 5