Questions tagged [rack]

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

rack
Filter by
Sorted by
Tagged with
0 votes
1 answer
439 views

AnyLogic: pick multiple products from the same cell in storage racks

I am trying to simulate a distribution center in AnyLogic. I have a question regarding retrieving of products from a storage rack cell. I store Handling Units (agents) in the storage racks. A ...
Kevin America's user avatar
5 votes
2 answers
1k views

Rack::File is deprecated, please use Rack::Files instead - new Ruby on Rails project

When I create new Ruby on Rails (6.0.2.1) project with Hix on Rails Application Template, I get the following error: Rack::File is deprecated, please use Rack::Files What exactly causes it?
wscourge's user avatar
  • 11k
0 votes
1 answer
293 views

AnyLogic: Pick products from a specific cell in storage rack

I am trying to pick products from a specific cell from a storage rack/storage system. In the RackStore block, it is possible to store products in a specific cell by providing the row, position and ...
Kevin America's user avatar
2 votes
0 answers
460 views

How to print Rack::Request as raw HTTP request?

I interested in the standard way to print an instance of a Rack::Request class as a text HTTP request. Example below. POST /cgi-bin/process.cgi HTTP/1.1 User-Agent: Mozilla/4.0 (compatible; MSIE5.01; ...
alex naumov's user avatar
1 vote
0 answers
414 views

How to stream downloads with rack.hijack and IO without them cutting off prematurely?

Our UI server needs to make certain downloadable files available to users. The files live on a specialized storage server. The UI server enforces some permissions and uses HTTP Basic Auth user/pwd to ...
skunkshow's user avatar
0 votes
1 answer
750 views

Rackup LoadError - any config.ru file gives LoadError when rackup command used

Ok, so this is my first ever question. I'm bracing for feeling dumb, but here goes. I'm currently learning Ruby before I become familiar with Ruby on Rails. I've been following an online course, and ...
take_courage's user avatar
-1 votes
1 answer
164 views

sinatra-cors not responding with 200 when using middleware [closed]

I am writing a little app for my own curiosity, and am having trouble with the sinatra-cors gem not responding with a 200. This causes Chrome to fail the options request (and subsequently not ...
Johann Venter's user avatar
2 votes
0 answers
118 views

Using env with rack_test

In a Rails app, I have the following configuration to run System Rspec specs. RSpec.configure do |config| config.before(:each, type: :system) do driven_by :rack_test end config.before(:...
Sig's user avatar
  • 5,750
0 votes
1 answer
160 views

Sample server & client for Rack hijack proxy questions

I've got sample app for hijack proxy server io_lambda = lambda{ |io| 3.times do |i| puts i io.write "David\r\n" end io.close } run lambda{ |req| [ ...
Andrey Khataev's user avatar
0 votes
1 answer
1k views

Sidekiq + Rails 6.0.0 in API mode : WARN -- : attack prevented by Rack::Protection::AuthenticityToken

I'm currently trying to setup a standalone rails 6.0.0 API fresh install (rails new xxx --api) + sidekiq (that includes Rack::Protection) After setting-up Rack::Cors, i get the following 403 error on ...
overlox's user avatar
  • 792
0 votes
1 answer
250 views

unicorn-worker-killer- why is it a problem if multiple Unicorn workers are killed at the same time?

From the unicorn-worker-killer README, I see the following comment in the notes about the Unicorn::WorkerKiller::Oom module: memory_limit_min and memory_limit_max specify the min and max of ...
Richie Thomas's user avatar
1 vote
0 answers
175 views

In Gitlab's "config.ru", why "require 'unicorn'" if it's already defined?

I'm doing a deep-dive into how Gitlab's web application works, and I'm starting by looking at the webserver it uses (Unicorn). The config.ru file looks like the following: if defined?(Unicorn) ...
Richie Thomas's user avatar
2 votes
0 answers
110 views

Log all Rack middleware invocations

For benchmarking purposes, I'd like to log all requests and responses handled by any Rack Middleware, in a Rails app. Something like: [Sep 6 09:00:00] Middleware A begins [Sep 6 09:00:01] Middleware ...
mahemoff's user avatar
  • 45.5k
0 votes
2 answers
53 views

What's the actual URL Rails generated for HTTP Verb PATCH?

Please bear with a newbie. I understand how Rails provides simple request with GET for simple URL links like localhost:3000/rooms/11/listing. The format is straight forward as stated in the Routes ...
Zakir Jaafar's user avatar
0 votes
1 answer
30 views

Where should URIs be decoded in a Nginx - Puma - Rails stack?

I've a Rails app that needs to accept some URIs with unencoded %2f (forward slashes). These characters need to be interpreted as forward slashes, even though I know it's not ideal. What would be the ...
MetalElf0's user avatar
  • 1,097
2 votes
1 answer
1k views

Strategies for multithreaded singleton object in Rails

I have a compelling use case where notifications happen in realtime at the server level. I would like to push these events out over a websocket using Rails' ActionCable. How Can I reliably maintain a ...
adc's user avatar
  • 557
0 votes
0 answers
249 views

JSON.parse with a valid JSON string returns nil in Rack request handler. Same string parses fine outside Rack

My Sinatra server is receiving a JSON string as part of a POST request body. The request body is read and converted to a string like this: request.body.rewind body_str = request.body.read....
Engin Kurutepe's user avatar
3 votes
2 answers
2k views

Raising 500 errors deliberately in Sinatra in order to test how they are handled

I want to write an RSpec test which verifies that, should a 500 error occur in my Sinatra-powered API, the error will be caught by a Sinatra error definition and returned to the client in a JSON ...
Aaron Christiansen's user avatar
1 vote
1 answer
801 views

How to not stretch a shape I put inside a server rack in draw.io?

Every shape I place inside a server rack is stretched out over the full width of the server rack. I need to place some smaller items in the rack, how do I prevent the stretching? I have tried to add ...
markovang's user avatar
0 votes
1 answer
1k views

Use PORT environment variable in Rack/Sinatra

I'm looking to set the listening port within my Rack and Sinatra app, using the PORT environment variable if set otherwise to a default. I thought I may be able to do something like the following but ...
Zak's user avatar
  • 1,940
0 votes
1 answer
207 views

Simple Ruby server setup using Thin as a simple rhtml server (like Webrick)

my simple Webrick server serves up static html and rhtml embedded ruby files. How would I achieve the same with a multithreaded or multiprocess Ruby server like Thin? Webrick setup: #!/usr/bin/ruby ...
user981165's user avatar
0 votes
1 answer
57 views

How to dump Bugsnag report in Ruby

I would like to dump the complete report sent to Bugsnag in Ruby. I tried this: Bugsnag.before_notify_callbacks << lambda {|report| puts report } But the only result I get is the ...
Attilio's user avatar
  • 1,682
0 votes
1 answer
537 views

Capybara error on HTTP.get: HTTP::ConnectionError Exception: failed to connect: Connection refused - connect(2) for "localhost" port 3000

My app is set to use Capybara and minitest with RackTest driver. This is the main config in test_helper.rb: require 'capybara/rails' require 'capybara/minitest' class ActionDispatch::IntegrationTest ...
ntonnelier's user avatar
  • 1,549
7 votes
1 answer
3k views

What is rack in ruby? What is puma in ruby?

According to the definition, the puma is kind of web server and the rack is an interface between web server and application server. But, lots of videos mention that rack is a interface between web ...
Vic Xu's user avatar
  • 91
1 vote
0 answers
552 views

Rescue Rack RangeError in controller

I have a rails app with a GraphQL endpoint which accepts large amounts of data. A single post could easily be 500Kb. I have bumped the key_space_limit; Rack::Utils.key_space_limit = 8 * 65536 but I ...
Gregology's user avatar
  • 1,685
1 vote
1 answer
51 views

Rspec: Capybara server map a directory

I have a set of files in a folder under spec/support/fixtures directory. I need those files to be accessible through an uri such as "http://127.0.0.0:#{Capybara.current_session.server.port}/...
Benjamin Bouchet's user avatar
2 votes
0 answers
107 views

Rackup Equivalent to defined(Rails::Server)

I'm trying to run a method immediately on startup in my rails project. Previously I used the following for running locally # application.rb if defined?(Rails::Server) config.after_initialize do ...
Smitto's user avatar
  • 93
0 votes
1 answer
46 views

Filtering error reports in rails production environment

Applications have notifications issued via e-mail as set-up in `environments/production.rb' : Rails.application.config.middleware.use ExceptionNotification::Rack, :email => { :email_prefix =&...
Jerome's user avatar
  • 5,897
1 vote
1 answer
201 views

What is an optimal way of blocking unsupported/invalid requests in Rails?

Sample a Rails application running on Heroku. We get a certain pattern of (seemingly DoS) requests each day and I'd like to configure the middleware to handle these fellas, instead of the Rails ...
Aayush Kothari's user avatar
1 vote
2 answers
263 views

Sinatra (rack.session) session auth

I have a Padrino application. And I would like to share the session between instances (load balanced machines). I set my own secret, but I don't know what else to set to let it work for session ...
Levi's user avatar
  • 77
1 vote
1 answer
305 views

Zero Bytes Sent When Sending Axlsx Gem Generated File From Sinatra

Attempting to prompt a download window and stream an XLSX file using Ruby Sinatra and the AXLSX gem, my excel file serializes successfully to local file, so I know its a valid excel doc, but I need it ...
ochero's user avatar
  • 837
1 vote
1 answer
390 views

How can I see what `Rack::Protection` is doing with Sinatra server?

I have a Sinatra server in an AWS environment with a load balancer between the client and the server. Unless I do something like: disable: protection it gives 'Forbidden' on a redirect. I don't ...
Ross Attrill's user avatar
  • 2,642
0 votes
1 answer
161 views

How to rewrite to a different domain and same URL by using rack-rewrite?

I want to make a rewrite to another domain and URL browser will show not be changed. config.middleware.insert_before(Rack::Runtime, Rack::Rewrite) do r301 %r{/example(.*)}, 'https://example.com$1'...
Kei Maejima's user avatar
1 vote
1 answer
1k views

Heroku: NoMethodError: undefined method `timeout=' for Rack::Timeout:Class

Just updated a Rails 4.2 app to 5.2.1 and having trouble pushing it to Heroku. Errors below. I've tried what's recommended here and here by adding following to my rack_timeout.rb initializer. Rails....
Meltemi's user avatar
  • 38.2k
1 vote
1 answer
495 views

Puma with Padrino, CPU consumption will not stop

I have one problem which I am trying to solve, I have Ruby web project, written in Padrino, it is quite simply project. But I have problems with running the Puma. Everything works fine, but after a ...
Mlok's user avatar
  • 155
0 votes
1 answer
2k views

How do I merge multiple JSON objects in one file ruby

I'm trying to loop over JSON objects and I can't because I have two separate JSON objects in my one JSON file. How would I merge the two objects? This is how my Json file currently looks like answers....
testprogrammer's user avatar
0 votes
1 answer
175 views

how can I save the form responses in a JSON file in ruby?

I'm trying to store the responses that are submitted on my form/survey to a JSON file. Currently my JSON file returns null. I'm having trouble figuring out how to save responses on my form to a JSON ...
testprogrammer's user avatar
1 vote
1 answer
597 views

How to start Sidekiq Web UI on public 0.0.0.0?

In order to start sidekiq web UI I currently do: rackup sidekiq_web.ru -p 9293 However once puma starts it listens only to localhost. * Listening on tcp://localhost:9293 How can I run this on http:...
stratis's user avatar
  • 7,860
0 votes
1 answer
110 views

Making a Rack CLI

I'm trying to make a framework similar to Rails, but purely focused on GraphQL. Once nice feature of Rails is that it provides a CLI interface and a config.ru for Rack. Therefore, you can call rackup ...
Nicholas Yang's user avatar
0 votes
1 answer
361 views

CORS issues with vue/node to rack/thin via nginx

I had this working properly and all of a sudden during a restart stopped working and I can't get to the bottom of what happened. Basically, vue/node (dev) mode is using http but the ajax uses https ...
Shreko's user avatar
  • 321
0 votes
1 answer
347 views

Timeout not working on heroku for Rails application

I tried increasing timeout, I have app running in production and it's deployed on heroku. I have some requests which takes more than 30 seconds. And those requests are insertion in database. Due to ...
ZeeAzmat's user avatar
  • 1,509
-2 votes
1 answer
352 views

How does the Rack::Request #params method work in regard to 'super'?

# File 'lib/rack/request.rb', line 19 def params @params ||= super end https://www.rubydoc.info/gems/rack/Rack/Request#params-instance_method I know the basics of super, but I don't know how it ...
Tao's user avatar
  • 3
0 votes
1 answer
688 views

How to decode encoded query params in GET request using grape-api

I'm using grape-api and having a problem with making a GET request from my front-end service with encoded query params. This is how my endpoint is set up to receive the params: params do requires :...
amrrbakry's user avatar
  • 599
5 votes
0 answers
2k views

rails s Rack app error handling request { GET / } on windows

I have the same app running on Mac and Windows. When I start the server on mac, it runs normally, when I try to run it on Windows I get the following error: 2018-07-30 20:35:30 -0300: Rack app error ...
fedest's user avatar
  • 1,300
4 votes
1 answer
2k views

Puma server stop by ThreadError (deadlock; recursive locking)

I'm running mastodon in server(1 core, 4GB RAM). It sometimes happens deadrock and server error. I could not find out when to happen this error, but it did multiple times. A temporary solution is ...
yhtsk's user avatar
  • 41
4 votes
1 answer
1k views

Rails ActionController ignores request headers

I have a simple controller method that logs headers via ActionController's #headers method: class ThingsController < ActionController::Base def show Rails.logger.info headers render ...
tassock's user avatar
  • 1,653
0 votes
1 answer
36 views

How to pipe output from external process in Rack

In a nutshell, I want to make an on-the-fly thumbnail script. All I want to do is run ImageMagick on an existing image file and pipe the output back to the web client. I somehow can't quite figure out ...
tscheingeld's user avatar
0 votes
0 answers
37 views

Exclude some paths from Rack::Protection

I want to use Rack::Protection::JsonCsrf only for a few paths, say /user-login. However I am not able to find an option related to this. Can someone kindly point me to some example/documentation. ...
Amit Teli's user avatar
  • 925
2 votes
0 answers
896 views

Interpreting rack-timeout service time

In a Rails app I'm using rack-timeout set to time out requests taking longer than 30 seconds. Strangely, there are situations where rack-timeout enters extremely late and the overall service time of ...
Jan Klimo's user avatar
  • 4,831
1 vote
0 answers
73 views

Can't authenticate access to Rack Application mounted in Rails 4.0

So I'm struggling to figure out a reasonable way to authenticate a Rake Application through my rails app so that the route it is on is only accessible to admin users. I am mounting the Rake ...
Jeremy's user avatar
  • 21

1 2
3
4 5
33