* request path_info being ignored?
@ 2009-07-09 20:21 Mark Larimer
2009-07-09 21:30 ` Joshua Peek
0 siblings, 1 reply; 2+ messages in thread
From: Mark Larimer @ 2009-07-09 20:21 UTC (permalink / raw)
To: Rack Development
I've got Rack fronting a Rails 2.3.2 app. And I wrote some Rack
middleware to do a simple rewrite of the request url. Here is a
simplified version of the call() method:
def call(env)
req = Rack::Request.new(env)
req.path_info = "/people/12345/accounts.xml"
@app.call(env)
end
When Rack operates on this request and passes control through to the
Rails app, I expect the Rails router to call the index method of the
accounts controller...but instead the path_info that was set in the
middleware method is being completely ignored, and Rails is routing
based on the original path.
If I look at env['PATH_INFO'] after the req.path_info=() call, it
shows the new value.
What am I missing?
Thanks.
--mark
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: request path_info being ignored?
2009-07-09 20:21 request path_info being ignored? Mark Larimer
@ 2009-07-09 21:30 ` Joshua Peek
0 siblings, 0 replies; 2+ messages in thread
From: Joshua Peek @ 2009-07-09 21:30 UTC (permalink / raw)
To: rack-devel
Rails uses request uri instead of path info. I feel this is incorrect,
but its the current behavior. You'll need to update REQUEST_URI as
well.
On Thu, Jul 9, 2009 at 3:21 PM, Mark Larimer<larimer@fantasybowl.com> wrote:
>
> I've got Rack fronting a Rails 2.3.2 app. And I wrote some Rack
> middleware to do a simple rewrite of the request url. Here is a
> simplified version of the call() method:
>
> def call(env)
> req = Rack::Request.new(env)
> req.path_info = "/people/12345/accounts.xml"
> @app.call(env)
> end
>
> When Rack operates on this request and passes control through to the
> Rails app, I expect the Rails router to call the index method of the
> accounts controller...but instead the path_info that was set in the
> middleware method is being completely ignored, and Rails is routing
> based on the original path.
>
> If I look at env['PATH_INFO'] after the req.path_info=() call, it
> shows the new value.
>
> What am I missing?
>
> Thanks.
> --mark
>
--
Joshua Peek
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-07-09 21:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-09 20:21 request path_info being ignored? Mark Larimer
2009-07-09 21:30 ` Joshua Peek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).