rack-devel archive mirror (unofficial) https://groups.google.com/group/rack-devel
 help / color / mirror / code / Atom feed
* How to use a rack middleware in rails application?
@ 2012-04-18 13:10 shinn
  2012-04-18 22:09 ` James Tucker
  0 siblings, 1 reply; 5+ messages in thread
From: shinn @ 2012-04-18 13:10 UTC (permalink / raw)
  To: rack-devel

[-- Attachment #1: Type: text/plain, Size: 312 bytes --]

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<https://gist.github.com/206529>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!

[-- Attachment #2: Type: text/html, Size: 333 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to use a rack middleware in rails application?
  2012-04-18 13:10 How to use a rack middleware in rails application? shinn
@ 2012-04-18 22:09 ` James Tucker
  2012-04-19  4:11   ` shinn
  0 siblings, 1 reply; 5+ messages in thread
From: James Tucker @ 2012-04-18 22:09 UTC (permalink / raw)
  To: rack-devel

[-- Attachment #1: Type: text/plain, Size: 598 bytes --]


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!

http://guides.rubyonrails.org/rails_on_rack.html

It sounds like you probably want CORS though, not a proxy.

http://blog.davelyon.net/cross-origin-resource-sharing-on-rails
http://www.tsheffler.com/blog/?p=428
http://www.google.com/search?q=CORS+on+rails

[-- Attachment #2: Type: text/html, Size: 1200 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to use a rack middleware in rails application?
  2012-04-18 22:09 ` James Tucker
@ 2012-04-19  4:11   ` shinn
  2012-04-20 19:58     ` James Tucker
  0 siblings, 1 reply; 5+ messages in thread
From: shinn @ 2012-04-19  4:11 UTC (permalink / raw)
  To: rack-devel

[-- Attachment #1: Type: text/plain, Size: 1132 bytes --]

Hi, thanks for your reply.

According to this source<https://developer.mozilla.org/en/HTTP_access_control>, 
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.

On Thursday, April 19, 2012 6:09:45 AM UTC+8, raggi wrote:
>
>
> 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<https://gist.github.com/206529>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!
>
>
> http://guides.rubyonrails.org/rails_on_rack.html
>
> It sounds like you probably want CORS though, not a proxy.
>
> http://blog.davelyon.net/cross-origin-resource-sharing-on-rails
> http://www.tsheffler.com/blog/?p=428
> http://www.google.com/search?q=CORS+on+rails
>

[-- Attachment #2: Type: text/html, Size: 1830 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to use a rack middleware in rails application?
  2012-04-19  4:11   ` shinn
@ 2012-04-20 19:58     ` James Tucker
  2012-04-21  3:16       ` shinn
  0 siblings, 1 reply; 5+ messages in thread
From: James Tucker @ 2012-04-20 19:58 UTC (permalink / raw)
  To: rack-devel

[-- Attachment #1: Type: text/plain, Size: 1171 bytes --]

I suggest you proxy only the routes you need.

On Apr 18, 2012, at 9:11 PM, shinn wrote:

> 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.
> 
> On Thursday, April 19, 2012 6:09:45 AM UTC+8, raggi wrote:
> 
> 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!
> 
> http://guides.rubyonrails.org/rails_on_rack.html
> 
> It sounds like you probably want CORS though, not a proxy.
> 
> http://blog.davelyon.net/cross-origin-resource-sharing-on-rails
> http://www.tsheffler.com/blog/?p=428
> http://www.google.com/search?q=CORS+on+rails


[-- Attachment #2: Type: text/html, Size: 2199 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: How to use a rack middleware in rails application?
  2012-04-20 19:58     ` James Tucker
@ 2012-04-21  3:16       ` shinn
  0 siblings, 0 replies; 5+ messages in thread
From: shinn @ 2012-04-21  3:16 UTC (permalink / raw)
  To: rack-devel

Yes, that's what I wanted to do with the rack middleware. So how to use it?

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2012-04-21  3:16 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-18 13:10 How to use a rack middleware in rails application? shinn
2012-04-18 22:09 ` James Tucker
2012-04-19  4:11   ` shinn
2012-04-20 19:58     ` James Tucker
2012-04-21  3:16       ` shinn

Code repositories for project(s) associated with this inbox:

	https://80x24.org/mirrors/rack.git

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).