json - Returning gzipped content on a Sinatra app -
i have sinatra app inside ror3 app.
i defined sinatra module , added following redirect in ror3 routes
match '/v2', mysinatramodule, :anchor=>false
my sinatra app serving services within /v2/* not being gzipped. tried adding "use rack:deflater" in config.ru since passes through ror3 not working. json service, returns string.
i tried using gzip::zlibwriter , compresses output, not interpreted gzipped on other side.
any help?
there's 2 things come mind try.
firstly, instead of using ror router, let rack handle it. there several ways instead, easiest probably:
# config.ru require 'sinatra_module' require 'rails_app' map "/" run railsapp end map "/v2" use rack::deflater # might want put in sinatra app. run mysinatramodule end
the other thing might try setting content-encoding
header "gzip"
, or, if doesn't work try setting content-type
header "application/x-gzip"
(i'm more dubious on changing type header though). rack::deflater
should handle though.
Comments
Post a Comment