Skip to content

Shotgun visits every mapping in config.ru regardless the request #59

@Darkside73

Description

@Darkside73

ENV

  ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
  shotgun-0.9.1
  rack-1.6.1
  thin-1.6.3

Simple config.ru

  map '/' do
    p "root"
    run Proc.new {|env| [200, {"Content-Type" => "text/html"}, ["root"]]}
  end

  map "/assets" do
    p "assets"
    run Proc.new {|env| [200, {"Content-Type" => "text/html"}, ["assets"]]}
  end

  map "/admin" do
    p "admin"
    run Proc.new {|env| [200, {"Content-Type" => "text/html"}, ["admin"]]}
  end

Run shotgun server

  $ shotgun

Hit the server:

  $ curl http://localhost:9393/
  root

Server log output

  == Shotgun/Thin on http://127.0.0.1:9393/
  Thin web server (v1.6.3 codename Protein Powder)
  Maximum connections set to 1024
  Listening on 127.0.0.1:9393, CTRL+C to stop
  "root"
  "assets"
  "admin"
  127.0.0.1 - - [15/Jun/2015:18:52:52 +0300] "GET / HTTP/1.1" 200 - 0.0008

This is really nasty when I use shotgun with sinatra and sprockets:
every asset request hits whole application and slow down page loading a lot

Is it by design?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions