How to use a rack middleware in rails application?

301 views
Skip to first unread message

shinn

unread,
Apr 18, 2012, 9:10:12 AM4/18/12
to rack-...@googlegroups.com
Hi all,

I'm currently developing a rails app that required to do cross side scripting with ajax. I've been google around and found this rack middleware that used rack on doing proxy. However I have no idea on how to use it in my app. Please help, I'm using Rails 3.2.3. Thanks!

James Tucker

unread,
Apr 18, 2012, 6:09:45 PM4/18/12
to rack-...@googlegroups.com

On Apr 18, 2012, at 6:10 AM, shinn wrote:

Hi all,

I'm currently developing a rails app that required to do cross side scripting with ajax. I've been google around and found this rack middleware that used rack on doing proxy. However I have no idea on how to use it in my app. Please help, I'm using Rails 3.2.3. Thanks!

shinn

unread,
Apr 19, 2012, 12:11:10 AM4/19/12
to rack-...@googlegroups.com
Hi, thanks for your reply.

According to this source, CORS will required the targeted domain (http://bar.other in this example) to response with the "Access-Control-Allow-Origin".

This is the reason I'm not using CORS, because the targeted domain is not belong to me, I've no way to add the "Access-Control-Allow-Origin" header on its server. Correct me if I'm wrong.

James Tucker

unread,
Apr 20, 2012, 3:58:16 PM4/20/12
to rack-...@googlegroups.com
I suggest you proxy only the routes you need.

shinn

unread,
Apr 20, 2012, 11:16:34 PM4/20/12
to rack-...@googlegroups.com
Yes, that's what I wanted to do with the rack middleware. So how to use it?
Reply all
Reply to author
Forward
0 new messages