Questions tagged [rack]

Rack provides a minimal interface between webservers supporting Ruby and Ruby frameworks.

Rack is a minimal, modular and adaptable interface for developing web applications in Ruby. By wrapping HTTP requests and responses in the simplest way possible, it unifies and distills the API for web servers, web frameworks, and software in between (the so-called middleware) into a single method call.

Useful Links

1617 questions
0
votes
2 answers

JQuery is not getting any response from my Sinatra using Rack

I've been struggle a little bit. I have my Sinatra Web Server using Rack as a middleware as I need to have several Sinatra's applications. The application is going to be a REST API that returns a json reponse, so in my Sinatra Application I have…
moisesvega
  • 435
  • 1
  • 5
  • 16
0
votes
1 answer

Where should I set HTTP headers, such as Expires?

I want to deploy an app using Sinatra on Phusion Passenger w/ nginx. If I want to set the Expires header on my static content - stylesheets, say - there are appear to be three places where I could accomplish this. In my Sinatra app, using the…
dbrown0708
  • 4,544
  • 4
  • 25
  • 22
0
votes
1 answer

Path based VirtualHosts with Passenger, Rack and Apache

I'm trying to create a path-based versioning system for our API, something like: GET api.ingeniapi.com/v1/items vs GET api.ingeniapi.com/v2/items/magic_new_thing How do I setup Apache to route traffic from these two paths to different rack…
dangerous.beans
  • 599
  • 7
  • 23
0
votes
1 answer

How to test creation of a Rack application using cucumber?

I am creating a Ruby command line application that will generate a Rack application. I want to test that the Rack application that is created is a valid Rack application. I have started using Aruba and Cucumber to test that the CLI creates the…
Andrew
  • 227,796
  • 193
  • 515
  • 708
0
votes
2 answers

Helios: How to protect with a password

Seems like anyone knowing your URL would stick it a /admin and be able to spam your users ;) How would you prevent that?
StuFF mc
  • 4,137
  • 2
  • 33
  • 32
0
votes
1 answer

rack-rewrite 301 not matching for specific query

Can any one tell me why this works: r301 %r{(?:images\/)(\d*.jpe?g|png|gif)$}, 'http://mybucket.s3.amazonaws.com/540x310/$1' URI = http://www.mysite.com/images/42720.jpeg and this doesn't r301 %r{(?:resized_images\/\d*x\d*\/)(\d*.jpe?g|png|gif)$},…
dp6ai
  • 41
  • 3
0
votes
1 answer

rack doesn't identified as a command in rails4

I have a rails4 project gem 'rails', '4.0.2', and I have created a custom rack module in config/initializers/request_timer.rb, from Ryan bates screencast but when I run the command rack middleware, inside my project, it says -bash: rack: command…
sameera207
  • 16,547
  • 19
  • 87
  • 152
0
votes
1 answer

Get Rack to load config from Gem

Is it possible to run Rack and specify that it should look for config.ru from one of the project's Gem dependencies rather than the project's files on the local filesystem? I'm sure this is a 'wrong' pattern, but we've got project A that has a load…
DeejUK
  • 12,891
  • 19
  • 89
  • 169
0
votes
0 answers

Real Time Routes. No route matches in rspec

I'm in over my head and can't figure a way out. Any help or direction would be great. Thank you. I have a catchall route that works in real life but fails in respec. If I hardcode in a test route it passes my tests. Base Code routes.rb class…
haley
  • 1,573
  • 2
  • 12
  • 19
0
votes
1 answer

Redis connection management on Rack

If I am using ActiveRecord, I have to use this middleware: use ActiveRecord::ConnectionAdapters::ConnectionManagement This will close connection after each request. I am wondering if there's something similar I have to use if I want to use the…
0xSina
  • 20,973
  • 34
  • 136
  • 253
0
votes
2 answers

Rack/Sinatra Method Not Allowed

I am developing a simple web app using Sinatra and using rack as the middleware and hence have a config.ru. To run the application I use shotgun config.ru. I have no problem when the application does a GET request. But my app has a couple of POST…
swaroopsm
  • 1,389
  • 4
  • 18
  • 34
0
votes
1 answer

Rails 3.x startup error on Dreamhost - session_store.rb issue?

Here's another Rails-on-Dreamhost installation error. Used DH's own "getting started" wiki page. No issue getting initial "Welcome aboard" message. Local app created using mysql. Gems frozen during creation. DBs created on Dreamhost w/o apparent…
Brian Piercy
  • 631
  • 1
  • 7
  • 22
0
votes
1 answer

Cannot load Rack Middleware file into Rails app

Trying to get Heroku's WebSocket tutorial working with a Rails app but the middleware is not loading. Steps to reproduce: Created a Rails 3.2.15 app. Add faye-websocket gem and run bundle install Create app/middleware directory in the…
Misha M
  • 10,979
  • 17
  • 53
  • 65
0
votes
1 answer

Catch exception from included middleware

I have a Sinatra app and I'm using the rack_csrf gem to protect my forms, this gem raise an exception if the CSRF token is invalid and I want to catch it for logging purposes. Is there a way to catch this exception or get the returned status code…
rdavila
  • 370
  • 3
  • 9
0
votes
2 answers

HelloWorld Rack Program : NoMethodError: undefined method `each'

I am trying to execute below HelloWorld rack program and getting an error. Appreciate any help. ruby version ruby 1.9.3p448 (2013-06-27) [x86_64-cygwin] # helloworld.rb require 'rack' require 'rack/server' class HelloWorld def response [200,…
Venu
  • 303
  • 6
  • 21