You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@shindig.apache.org by "Davies,Douglas" <da...@oclc.org> on 2011/03/29 20:33:15 UTC

Shindig and webapp on same host/domain or not?

I want to follow up with an earlier thread I had about webroot that has
taken me a different direction.  Sorry for starting a new thread, but
the listserv (or stupid entourage on the mac) is making it so that my
messages have been posted as 'daviesd' and not 'daviesd@oclc.org' and
this seems to be affecting the delivery and even the web view of the
archive.  Anyway...

 

I need some assistance as far as how shindig and the application webapp
using shindig to render embedded gadgets should be deployed.  I've
successfully gotten shindig running along-side my application webapp
that uses it.  Both projects are their own war file and deployed to the
same server (and thus same fully qualified domain name).  The shindig
war has been patched to use the /shindig web context and the application
war runs as root.  So /index.html is the page that includes the common
container javascript and references /shindig/gadgets, etc.

 

Is the desired deployment architecture:

 

1.       Add shindig as part of an existing webapp 

2.       As a separate webapp on the same host/domain (as I've done) 

3.       Or as a separate webapp on a totally different host/domain (so
the application runs at www.mydomain.com and shindig runs at
www.myshindig.com).

 

I'm able to get things to work fine with scenario 1 and 2.  Scenario 3
is where I have problems.  The common container doesn't seem to support
shindig on a different host/domain then the webapp using it.  If I
deploy shindig to a different host and run my webapp locally, I see it
trying to use http://localhost:8080/shindig/rpc instead of
http://www.myshindig.com/shindig/rpc).  It appears the javascript apis
are using relatives paths based on the current browser host.

 

On top of all this I've seen various threads about security concerns as
to where the gadget is running.  In scenarios 1 and 2 it possibly has
access to private information in the webapp that is using it.  In
scenario 3 it's running in an isolated shindig farm and any malicious
activity would only affect those servers but not the main application.

 

As I've said in the previous thread... I might be totally
misunderstanding this.  I really want to push for scenario 3, but if
it's not supported in the common container (or in shindig at all) as
this thread suggests

 

http://mail-archives.apache.org/mod_mbox/shindig-dev/201102.mbox/%3cAANL
kTingSX79SQAgrjFa4nPDHH4XGKSWOUN4MF_eH+Z1@mail.gmail.com%3e

 

then I'm willing to at least settle for scenario 2, assuming there are
not security concerns there.

 

Thanks,

Doug Davies

OCLC, Online Computer Library Catalog


FYI: OpenSocial Hackathon in Raleigh/Durham on April 27th 2011

Posted by Matthew G Marum <mg...@us.ibm.com>.
Date/Time:  Wednesday, April 27th 2011,  3pm - 9pm
Location: Raleigh / Durham, North Carolina USA

We're organizing an OpenSocial Hackathon in the RTP area.  Great
opportunity to get together and write some code, try some interop, or just
network with folks.

I'm expecting some Apache Shindig committers to be there, so this is a
great opportunity if you just want to learn more about Shindig.  Mark
Weitzel (president of OpenSocial Foundation) will be there too.

http://docs.opensocial.org/display/OSF/OpenSocial+Hackathon+RTP+-+April
+27th+2011

Please sign up via Eventbrite if you are interested in attending.
http://opensocialhackathonrtp.eventbrite.com/

.....PIZZA will be provided!

Matt Marum

RE: Shindig and webapp on same host/domain or not?

Posted by Stanton Sievers <ss...@us.ibm.com>.
Hi Jesse,

Thanks for the great information.  Regarding your questions:

-- Security Tokens
- You are correct in that the GadgetHandlers servlet can create the 
security token (gadgets.token).  The TokenResponse that is generated in 
GadgetsHandlerService will contain the encrypted token.  You'll need to 
change your configuration in container.js.  Look for 
gadgets.securityTokenType. 

- In the common container's service.js, you will find 
osapi.container.Service.prototype.getGadgetToken which does this http 
request.  On the client side, it looks like the common container refresh 
mechanism will take care of the initial security token fetch.  It also 
uses the auth-refresh feature to update the security token once fetched, 
which simply delegates to the shindig.auth feature.

-- User prefs
- I have yet to find a mechanism for persisting user prefs, but I'll keep 
digging.  However, there is a persistence API for app data.  Take a look 
at JPASocialModule.  It binds the AppDataService to AppDataServiceDb which 
is setup to use an Apache Derby backend.  By default this isn't used as 
the SampleModule binds the AppDataService to the JsonDbOpensocialService 
instead.

I hope that makes sense.  I'm still digging through this code myself to 
understand the big picture. 

Best regards,
-Stanton



From:   "Ciancetta, Jesse E." <jc...@mitre.org>
To:     "dev@shindig.apache.org" <de...@shindig.apache.org>, Christiaan Hees 
<ch...@q42.nl>, 
Cc:     Michael Hermanto <mh...@gmail.com>, Kris Vishwanathan 
<Kr...@IBMUS.apache.org>
Date:   03/30/2011 09:09
Subject:        RE: Shindig and webapp on same host/domain or not?



We make the calls to fetch gadget metadata on the server side as well and 
then cache the results in the database we have backing our custom 
container.  So basically when we add a new gadget to our gadget repository 
we fetch the gadget metadata at that time in Java code (part of our custom 
container) and parse the response -- picking out the gadget user prefs, 
their default values, gadget sizing prefs, etc and put them into our 
database.  Then when we go to render gadgets at request time, we take all 
of those values from our local database and use them when constructing the 
gadget iframe URL's.  We also have support to refresh the gadget metadata 
from an admin screen, and if we find that and values have changed we 
update our database accordingly (user prefs have been added/removed, 
default values have changed, etc).

We've open sourced our code so you can have a look at it to see if it 
could help you -- its available at the following url: 
http://code.google.com/p/osec/

You could also look at Partuza for a PHP based example of how this stuff 
is done: http://code.google.com/p/partuza/

And I'm sure there's other containers around these days you could use as a 
reference as well -- there really wasn't though when we started our 
project (at least there wasn't a Java based container we could find) which 
was why we built our own.  We're also working with a few other groups on 
an Apache Incubator project called Rave which you can get more details on 
here:

http://wiki.apache.org/incubator/RaveProposal

We're still in the early stages with Rave but things are definitely 
starting to pick up there.

I haven't used common container myself but from what you're describing it 
sounds like it must fetch the gadget metadata on every page request 
directly from shindig and then use the response to construct the gadget 
iframe urls.  And if that's the case, and you've got the common container 
JS loaded up on a page served from domain X and it then tries to do an XHR 
to domain Y, as you've found it would definitely result in a cross domain 
security error.  I think the easiest way to solve that would be to 
implement a proxy mechanism on domain X which would proxy the metadata 
calls back to domain Y on the server side -- so the common container code 
would then be making the XHR's to domain X which would be allowed (you'd 
have to dig around in the common container code though to figure out how 
to get it to call domain X).  As Isaiah pointed out you should be able to 
use something like mod_proxy to do that pretty easily or as Michael points 
out in the thread you referenced you could try some tricks with hidden 
iframes sourced from domain Y to proxy requests back and forth.

One other note about security is that just having a different domain by 
itself for rendering gadgets isn't really sufficient -- to be completely 
secure you really want to be using wildcard DNS on your gadget rendering 
domain so that gadgets not only render on a completely different domain 
than your container (so they can't get to things like your SSO cookies) 
but they also render on unique sub domains from each other so they can't 
reach into each other's DOM's and pull out data.  Shindig supports this 
with a feature called locked domain -- the default scheme to generate the 
unique sub domains is <hash-of-gadget-spec-url>.your-gadget-domain.foo.

Whether or not all this DNS isolation is necessary though really depends 
on your use case -- if you're going to be rendering potentially untrusted 
gadgets written by third parties then you definitely want to be sure 
they're isolated on a jail domain, but if you're just serving up gadgets 
that you write it's probably not much of a concern.

Some other things off the top of my head that you're going to have to 
figure out how to deal with (and maybe they're already handled in common 
container but after a brief look I didn't see how/where):

-- Security Tokens.  You need encrypted security tokens to embed in the 
gadget iframe urls so that Shindig securely knows who the user is (and 
various other bits of info).  I see that common container has support to 
refresh tokens, but I don't see where tokens come from in the first place. 
 They have to be generated server side somewhere by a webapp who securely 
knows who the current user is (since they rely on symmetric encryption, 
and doing it on the client side would mean the key would be on the client 
side).  Maybe that's part of what the metadata servlet in Shindig does 
these days?  That would seem to imply SSO though between you're container 
and shindig domains which we've already said we often want to avoid...

-- User prefs.  It looks like common container is fetching user prefs with 
the metadata call -- last time I looked (which was a while ago) Shindig 
didn't support storing user prefs -- it only handled appdata (which out of 
the box is in an in-memory store -- you'll need to inject an 
implementation of the AppDataService that does real persistence if you 
want to use appdata).

If someone could answer those questions about how common container works 
I'd appreciate it -- I've been meaning to have a closer look at it myself 
but haven't had a chance.

Hope that helps!

>-----Original Message-----
>From: Davies,Douglas [mailto:daviesd@oclc.org]
>Sent: Wednesday, March 30, 2011 8:46 AM
>To: Christiaan Hees
>Cc: dev@shindig.apache.org; Michael Hermanto; Kris Vishwanathan
>Subject: Re: Shindig and webapp on same host/domain or not?
>
>Can you expound on that?  What do you mean you made the metadata call
>server side? What did you modify to do this? Won't I still have issues
>making other calls. Won't the web app on my localhost still use the
>relative path to make gadget API calls? I'm not sure I understand how
>the %host% substitution happens for the entries in container.js.
>
>Sent from my iPad
>
>On Mar 30, 2011, at 4:34 AM, "Christiaan Hees" <ch...@q42.nl>
>wrote:
>
>> I ended up doing the metadata call on the server side instead of the
>> client to avoid this issue and it works. But this is still using the
>> old container code, so I'm not sure if it's the best solution for you.
>>
>> On Wed, Mar 30, 2011 at 3:50 AM, Davies,Douglas <da...@oclc.org>
>wrote:
>>> I'm pretty sure it's just using one of the relative urls from
>container.js, because I know that if I modified all the urls on the
>server side I then saw it making the request to the shindig server
>correctly. However that request fails because there is no post data in
>the request for gadget metadata. Not sure if that is a cross domain
>issue or something else. Hopefully someone will have an idea. Thanks.
>>>
>>> Doug
>>>
>>> Sent from my iPhone
>>>
>>> On Mar 29, 2011, at 9:18 PM, "Ryan J Baxter" <rj...@us.ibm.com>
>wrote:
>>>
>>>> Hi Doug, I think you are right you should be striving for situation
>3, at
>>>> least that is my understanding.  We have not yet tried to separate
>Shindig
>>>> and the web app so they are running on two different domains.  The
>only
>>>> thing I can suggest is just diving into the common container code
>and
>>>> figure out how it is figuring out the domain to use.  Off the top of
>my
>>>> head I cannot recall how the common container is doing this.  Mike
>>>> Hermanto may know more....
>>>>
>>>> -Ryan
>>>>
>>>> Email: rjbaxter@us.ibm.com
>>>> Phone: 978-899-3041
>>>> developerWorks Profile
>>>>
>>>>
>>>>
>>>> From:   "Davies,Douglas" <da...@oclc.org>
>>>> To:     Kris Vishwanathan/Fairfax/IBM@IBMUS,
><de...@shindig.apache.org>,
>>>> Date:   03/29/2011 04:35 PM
>>>> Subject:        RE: Shindig and webapp on same host/domain or not?
>>>>
>>>>
>>>>
>>>> Hmmm... Now I am seriously confused.  I'm not sure we are both using
>the
>>>> same terminology here.
>>>>
>>>> I want this
>>>>
>>>> Server 1 (domain x)
>>>> ------------------
>>>> Shindig Server
>>>>
>>>> Server 2 (domain y)
>>>> ------------------
>>>> A webapp that uses javascript gadget api to communicate with shindig
>>>> server and render gadgets into iframes
>>>>
>>>> The problem is that server 2 is trying to call itself for the gadget
>api
>>>> calls, since the container javascript is using relative paths.
>>>>
>>>> As Isaiah then mentions, he is trying to do a rewrite rule on server
>2
>>>> to redirect the requests to the shindig server, however I suspect
>he'll
>>>> run into cross-domain issues here (as suggested by the common
>container
>>>> issue thread I referred to earlier).
>>>>
>>>> I'm sure there is just some configuration or concept I am missing
>here.
>>>>
>>>> doug
>>>>
>>>> -----Original Message-----
>>>> From: Kris Vishwanathan [mailto:v2kris@us.ibm.com]
>>>> Sent: Tuesday, March 29, 2011 3:27 PM
>>>> To: dev@shindig.apache.org
>>>> Cc: Davies,Douglas; dev@shindig.apache.org
>>>> Subject: Re: Shindig and webapp on same host/domain or not?
>>>>
>>>> Scenario three is a reasonable approach and that's how most of the
>>>> Social
>>>> networking sites run.
>>>>
>>>> Your deployment can look as below:
>>>>
>>>> Server1  (Domain X)
>>>> ------------
>>>>
>>>> Shindig Server
>>>> Common Container
>>>> index.html or your webpage that bootstraps container and your page
>etc..
>>>>
>>>>
>>>> Server 2 (Domain Y)
>>>> -------------
>>>> Your custom webapp
>>>> Other gadget apps
>>>>
>>>>
>>>> Hope it helps.
>>>>
>>>> Thanks and regards
>>>>
>>>> Kris Vishwanathan
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>





Re: Shindig and webapp on same host/domain or not?

Posted by daviesd <da...@oclc.org>.
Jesse,

Wow! Lots to consume here. I'll look this over and post if I have further
questions.  I'm still confused about how the %host% inside the container.js
gets massaged so that it makes the request to the domain shindig is running
on instead of localhost.  I know if I modified container.js to have the
fully qualified domain name I then saw it making the request properly but as
I said then I ran into the cross-domain issue.  I'll do some experimenting
here and let you know.

doug


On 3/30/11 9:09 AM, "Ciancetta, Jesse E." <jc...@mitre.org> wrote:

> We make the calls to fetch gadget metadata on the server side as well and then
> cache the results in the database we have backing our custom container.  So
> basically when we add a new gadget to our gadget repository we fetch the
> gadget metadata at that time in Java code (part of our custom container) and
> parse the response -- picking out the gadget user prefs, their default values,
> gadget sizing prefs, etc and put them into our database.  Then when we go to
> render gadgets at request time, we take all of those values from our local
> database and use them when constructing the gadget iframe URL's.  We also have
> support to refresh the gadget metadata from an admin screen, and if we find
> that and values have changed we update our database accordingly (user prefs
> have been added/removed, default values have changed, etc).
> 
> We've open sourced our code so you can have a look at it to see if it could
> help you -- its available at the following url: http://code.google.com/p/osec/
> 
> You could also look at Partuza for a PHP based example of how this stuff is
> done: http://code.google.com/p/partuza/
> 
> And I'm sure there's other containers around these days you could use as a
> reference as well -- there really wasn't though when we started our project
> (at least there wasn't a Java based container we could find) which was why we
> built our own.  We're also working with a few other groups on an Apache
> Incubator project called Rave which you can get more details on here:
> 
> http://wiki.apache.org/incubator/RaveProposal
> 
> We're still in the early stages with Rave but things are definitely starting
> to pick up there.
> 
> I haven't used common container myself but from what you're describing it
> sounds like it must fetch the gadget metadata on every page request directly
> from shindig and then use the response to construct the gadget iframe urls.
> And if that's the case, and you've got the common container JS loaded up on a
> page served from domain X and it then tries to do an XHR to domain Y, as
> you've found it would definitely result in a cross domain security error.  I
> think the easiest way to solve that would be to implement a proxy mechanism on
> domain X which would proxy the metadata calls back to domain Y on the server
> side -- so the common container code would then be making the XHR's to domain
> X which would be allowed (you'd have to dig around in the common container
> code though to figure out how to get it to call domain X).  As Isaiah pointed
> out you should be able to use something like mod_proxy to do that pretty
> easily or as Michael points out in the thread you referenced you could try
> some tricks with hidden iframes sourced from domain Y to proxy requests back
> and forth.
> 
> One other note about security is that just having a different domain by itself
> for rendering gadgets isn't really sufficient -- to be completely secure you
> really want to be using wildcard DNS on your gadget rendering domain so that
> gadgets not only render on a completely different domain than your container
> (so they can't get to things like your SSO cookies) but they also render on
> unique sub domains from each other so they can't reach into each other's DOM's
> and pull out data.  Shindig supports this with a feature called locked domain
> -- the default scheme to generate the unique sub domains is
> <hash-of-gadget-spec-url>.your-gadget-domain.foo.
> 
> Whether or not all this DNS isolation is necessary though really depends on
> your use case -- if you're going to be rendering potentially untrusted gadgets
> written by third parties then you definitely want to be sure they're isolated
> on a jail domain, but if you're just serving up gadgets that you write it's
> probably not much of a concern.
> 
> Some other things off the top of my head that you're going to have to figure
> out how to deal with (and maybe they're already handled in common container
> but after a brief look I didn't see how/where):
> 
> -- Security Tokens.  You need encrypted security tokens to embed in the gadget
> iframe urls so that Shindig securely knows who the user is (and various other
> bits of info).  I see that common container has support to refresh tokens, but
> I don't see where tokens come from in the first place.  They have to be
> generated server side somewhere by a webapp who securely knows who the current
> user is (since they rely on symmetric encryption, and doing it on the client
> side would mean the key would be on the client side).  Maybe that's part of
> what the metadata servlet in Shindig does these days?  That would seem to
> imply SSO though between you're container and shindig domains which we've
> already said we often want to avoid...
> 
> -- User prefs.  It looks like common container is fetching user prefs with the
> metadata call -- last time I looked (which was a while ago) Shindig didn't
> support storing user prefs -- it only handled appdata (which out of the box is
> in an in-memory store -- you'll need to inject an implementation of the
> AppDataService that does real persistence if you want to use appdata).
> 
> If someone could answer those questions about how common container works I'd
> appreciate it -- I've been meaning to have a closer look at it myself but
> haven't had a chance.
> 
> Hope that helps!
> 



RE: Shindig and webapp on same host/domain or not?

Posted by "Ciancetta, Jesse E." <jc...@mitre.org>.
We make the calls to fetch gadget metadata on the server side as well and then cache the results in the database we have backing our custom container.  So basically when we add a new gadget to our gadget repository we fetch the gadget metadata at that time in Java code (part of our custom container) and parse the response -- picking out the gadget user prefs, their default values, gadget sizing prefs, etc and put them into our database.  Then when we go to render gadgets at request time, we take all of those values from our local database and use them when constructing the gadget iframe URL's.  We also have support to refresh the gadget metadata from an admin screen, and if we find that and values have changed we update our database accordingly (user prefs have been added/removed, default values have changed, etc).

We've open sourced our code so you can have a look at it to see if it could help you -- its available at the following url: http://code.google.com/p/osec/

You could also look at Partuza for a PHP based example of how this stuff is done: http://code.google.com/p/partuza/

And I'm sure there's other containers around these days you could use as a reference as well -- there really wasn't though when we started our project (at least there wasn't a Java based container we could find) which was why we built our own.  We're also working with a few other groups on an Apache Incubator project called Rave which you can get more details on here:

http://wiki.apache.org/incubator/RaveProposal

We're still in the early stages with Rave but things are definitely starting to pick up there.

I haven't used common container myself but from what you're describing it sounds like it must fetch the gadget metadata on every page request directly from shindig and then use the response to construct the gadget iframe urls.  And if that's the case, and you've got the common container JS loaded up on a page served from domain X and it then tries to do an XHR to domain Y, as you've found it would definitely result in a cross domain security error.  I think the easiest way to solve that would be to implement a proxy mechanism on domain X which would proxy the metadata calls back to domain Y on the server side -- so the common container code would then be making the XHR's to domain X which would be allowed (you'd have to dig around in the common container code though to figure out how to get it to call domain X).  As Isaiah pointed out you should be able to use something like mod_proxy to do that pretty easily or as Michael points out in the thread you referenced you could try some tricks with hidden iframes sourced from domain Y to proxy requests back and forth.

One other note about security is that just having a different domain by itself for rendering gadgets isn't really sufficient -- to be completely secure you really want to be using wildcard DNS on your gadget rendering domain so that gadgets not only render on a completely different domain than your container (so they can't get to things like your SSO cookies) but they also render on unique sub domains from each other so they can't reach into each other's DOM's and pull out data.  Shindig supports this with a feature called locked domain -- the default scheme to generate the unique sub domains is <hash-of-gadget-spec-url>.your-gadget-domain.foo.

Whether or not all this DNS isolation is necessary though really depends on your use case -- if you're going to be rendering potentially untrusted gadgets written by third parties then you definitely want to be sure they're isolated on a jail domain, but if you're just serving up gadgets that you write it's probably not much of a concern.

Some other things off the top of my head that you're going to have to figure out how to deal with (and maybe they're already handled in common container but after a brief look I didn't see how/where):

-- Security Tokens.  You need encrypted security tokens to embed in the gadget iframe urls so that Shindig securely knows who the user is (and various other bits of info).  I see that common container has support to refresh tokens, but I don't see where tokens come from in the first place.  They have to be generated server side somewhere by a webapp who securely knows who the current user is (since they rely on symmetric encryption, and doing it on the client side would mean the key would be on the client side).  Maybe that's part of what the metadata servlet in Shindig does these days?  That would seem to imply SSO though between you're container and shindig domains which we've already said we often want to avoid...

-- User prefs.  It looks like common container is fetching user prefs with the metadata call -- last time I looked (which was a while ago) Shindig didn't support storing user prefs -- it only handled appdata (which out of the box is in an in-memory store -- you'll need to inject an implementation of the AppDataService that does real persistence if you want to use appdata).

If someone could answer those questions about how common container works I'd appreciate it -- I've been meaning to have a closer look at it myself but haven't had a chance.

Hope that helps!

>-----Original Message-----
>From: Davies,Douglas [mailto:daviesd@oclc.org]
>Sent: Wednesday, March 30, 2011 8:46 AM
>To: Christiaan Hees
>Cc: dev@shindig.apache.org; Michael Hermanto; Kris Vishwanathan
>Subject: Re: Shindig and webapp on same host/domain or not?
>
>Can you expound on that?  What do you mean you made the metadata call
>server side? What did you modify to do this? Won't I still have issues
>making other calls. Won't the web app on my localhost still use the
>relative path to make gadget API calls? I'm not sure I understand how
>the %host% substitution happens for the entries in container.js.
>
>Sent from my iPad
>
>On Mar 30, 2011, at 4:34 AM, "Christiaan Hees" <ch...@q42.nl>
>wrote:
>
>> I ended up doing the metadata call on the server side instead of the
>> client to avoid this issue and it works. But this is still using the
>> old container code, so I'm not sure if it's the best solution for you.
>>
>> On Wed, Mar 30, 2011 at 3:50 AM, Davies,Douglas <da...@oclc.org>
>wrote:
>>> I'm pretty sure it's just using one of the relative urls from
>container.js, because I know that if I modified all the urls on the
>server side I then saw it making the request to the shindig server
>correctly. However that request fails because there is no post data in
>the request for gadget metadata. Not sure if that is a cross domain
>issue or something else. Hopefully someone will have an idea. Thanks.
>>>
>>> Doug
>>>
>>> Sent from my iPhone
>>>
>>> On Mar 29, 2011, at 9:18 PM, "Ryan J Baxter" <rj...@us.ibm.com>
>wrote:
>>>
>>>> Hi Doug, I think you are right you should be striving for situation
>3, at
>>>> least that is my understanding.  We have not yet tried to separate
>Shindig
>>>> and the web app so they are running on two different domains.  The
>only
>>>> thing I can suggest is just diving into the common container code
>and
>>>> figure out how it is figuring out the domain to use.  Off the top of
>my
>>>> head I cannot recall how the common container is doing this.  Mike
>>>> Hermanto may know more....
>>>>
>>>> -Ryan
>>>>
>>>> Email: rjbaxter@us.ibm.com
>>>> Phone: 978-899-3041
>>>> developerWorks Profile
>>>>
>>>>
>>>>
>>>> From:   "Davies,Douglas" <da...@oclc.org>
>>>> To:     Kris Vishwanathan/Fairfax/IBM@IBMUS,
><de...@shindig.apache.org>,
>>>> Date:   03/29/2011 04:35 PM
>>>> Subject:        RE: Shindig and webapp on same host/domain or not?
>>>>
>>>>
>>>>
>>>> Hmmm... Now I am seriously confused.  I'm not sure we are both using
>the
>>>> same terminology here.
>>>>
>>>> I want this
>>>>
>>>> Server 1 (domain x)
>>>> ------------------
>>>> Shindig Server
>>>>
>>>> Server 2 (domain y)
>>>> ------------------
>>>> A webapp that uses javascript gadget api to communicate with shindig
>>>> server and render gadgets into iframes
>>>>
>>>> The problem is that server 2 is trying to call itself for the gadget
>api
>>>> calls, since the container javascript is using relative paths.
>>>>
>>>> As Isaiah then mentions, he is trying to do a rewrite rule on server
>2
>>>> to redirect the requests to the shindig server, however I suspect
>he'll
>>>> run into cross-domain issues here (as suggested by the common
>container
>>>> issue thread I referred to earlier).
>>>>
>>>> I'm sure there is just some configuration or concept I am missing
>here.
>>>>
>>>> doug
>>>>
>>>> -----Original Message-----
>>>> From: Kris Vishwanathan [mailto:v2kris@us.ibm.com]
>>>> Sent: Tuesday, March 29, 2011 3:27 PM
>>>> To: dev@shindig.apache.org
>>>> Cc: Davies,Douglas; dev@shindig.apache.org
>>>> Subject: Re: Shindig and webapp on same host/domain or not?
>>>>
>>>> Scenario three is a reasonable approach and that's how most of the
>>>> Social
>>>> networking sites run.
>>>>
>>>> Your deployment can look as below:
>>>>
>>>> Server1  (Domain X)
>>>> ------------
>>>>
>>>> Shindig Server
>>>> Common Container
>>>> index.html or your webpage that bootstraps container and your page
>etc..
>>>>
>>>>
>>>> Server 2 (Domain Y)
>>>> -------------
>>>> Your custom webapp
>>>> Other gadget apps
>>>>
>>>>
>>>> Hope it helps.
>>>>
>>>> Thanks and regards
>>>>
>>>> Kris Vishwanathan
>>>>
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>


Re: Shindig and webapp on same host/domain or not?

Posted by "Davies,Douglas" <da...@oclc.org>.
Can you expound on that?  What do you mean you made the metadata call server side? What did you modify to do this? Won't I still have issues making other calls. Won't the web app on my localhost still use the relative path to make gadget API calls? I'm not sure I understand how the %host% substitution happens for the entries in container.js.

Sent from my iPad

On Mar 30, 2011, at 4:34 AM, "Christiaan Hees" <ch...@q42.nl> wrote:

> I ended up doing the metadata call on the server side instead of the
> client to avoid this issue and it works. But this is still using the
> old container code, so I'm not sure if it's the best solution for you.
> 
> On Wed, Mar 30, 2011 at 3:50 AM, Davies,Douglas <da...@oclc.org> wrote:
>> I'm pretty sure it's just using one of the relative urls from container.js, because I know that if I modified all the urls on the server side I then saw it making the request to the shindig server correctly. However that request fails because there is no post data in the request for gadget metadata. Not sure if that is a cross domain issue or something else. Hopefully someone will have an idea. Thanks.
>> 
>> Doug
>> 
>> Sent from my iPhone
>> 
>> On Mar 29, 2011, at 9:18 PM, "Ryan J Baxter" <rj...@us.ibm.com> wrote:
>> 
>>> Hi Doug, I think you are right you should be striving for situation 3, at
>>> least that is my understanding.  We have not yet tried to separate Shindig
>>> and the web app so they are running on two different domains.  The only
>>> thing I can suggest is just diving into the common container code and
>>> figure out how it is figuring out the domain to use.  Off the top of my
>>> head I cannot recall how the common container is doing this.  Mike
>>> Hermanto may know more....
>>> 
>>> -Ryan
>>> 
>>> Email: rjbaxter@us.ibm.com
>>> Phone: 978-899-3041
>>> developerWorks Profile
>>> 
>>> 
>>> 
>>> From:   "Davies,Douglas" <da...@oclc.org>
>>> To:     Kris Vishwanathan/Fairfax/IBM@IBMUS, <de...@shindig.apache.org>,
>>> Date:   03/29/2011 04:35 PM
>>> Subject:        RE: Shindig and webapp on same host/domain or not?
>>> 
>>> 
>>> 
>>> Hmmm... Now I am seriously confused.  I'm not sure we are both using the
>>> same terminology here.
>>> 
>>> I want this
>>> 
>>> Server 1 (domain x)
>>> ------------------
>>> Shindig Server
>>> 
>>> Server 2 (domain y)
>>> ------------------
>>> A webapp that uses javascript gadget api to communicate with shindig
>>> server and render gadgets into iframes
>>> 
>>> The problem is that server 2 is trying to call itself for the gadget api
>>> calls, since the container javascript is using relative paths.
>>> 
>>> As Isaiah then mentions, he is trying to do a rewrite rule on server 2
>>> to redirect the requests to the shindig server, however I suspect he'll
>>> run into cross-domain issues here (as suggested by the common container
>>> issue thread I referred to earlier).
>>> 
>>> I'm sure there is just some configuration or concept I am missing here.
>>> 
>>> doug
>>> 
>>> -----Original Message-----
>>> From: Kris Vishwanathan [mailto:v2kris@us.ibm.com]
>>> Sent: Tuesday, March 29, 2011 3:27 PM
>>> To: dev@shindig.apache.org
>>> Cc: Davies,Douglas; dev@shindig.apache.org
>>> Subject: Re: Shindig and webapp on same host/domain or not?
>>> 
>>> Scenario three is a reasonable approach and that's how most of the
>>> Social
>>> networking sites run.
>>> 
>>> Your deployment can look as below:
>>> 
>>> Server1  (Domain X)
>>> ------------
>>> 
>>> Shindig Server
>>> Common Container
>>> index.html or your webpage that bootstraps container and your page etc..
>>> 
>>> 
>>> Server 2 (Domain Y)
>>> -------------
>>> Your custom webapp
>>> Other gadget apps
>>> 
>>> 
>>> Hope it helps.
>>> 
>>> Thanks and regards
>>> 
>>> Kris Vishwanathan
>>> 
>>> 
>>> 
>>> 
>>> 
>>> 
>> 
>> 
> 


Re: Shindig and webapp on same host/domain or not?

Posted by Christiaan Hees <ch...@q42.nl>.
I ended up doing the metadata call on the server side instead of the
client to avoid this issue and it works. But this is still using the
old container code, so I'm not sure if it's the best solution for you.

On Wed, Mar 30, 2011 at 3:50 AM, Davies,Douglas <da...@oclc.org> wrote:
> I'm pretty sure it's just using one of the relative urls from container.js, because I know that if I modified all the urls on the server side I then saw it making the request to the shindig server correctly. However that request fails because there is no post data in the request for gadget metadata. Not sure if that is a cross domain issue or something else. Hopefully someone will have an idea. Thanks.
>
> Doug
>
> Sent from my iPhone
>
> On Mar 29, 2011, at 9:18 PM, "Ryan J Baxter" <rj...@us.ibm.com> wrote:
>
>> Hi Doug, I think you are right you should be striving for situation 3, at
>> least that is my understanding.  We have not yet tried to separate Shindig
>> and the web app so they are running on two different domains.  The only
>> thing I can suggest is just diving into the common container code and
>> figure out how it is figuring out the domain to use.  Off the top of my
>> head I cannot recall how the common container is doing this.  Mike
>> Hermanto may know more....
>>
>> -Ryan
>>
>> Email: rjbaxter@us.ibm.com
>> Phone: 978-899-3041
>> developerWorks Profile
>>
>>
>>
>> From:   "Davies,Douglas" <da...@oclc.org>
>> To:     Kris Vishwanathan/Fairfax/IBM@IBMUS, <de...@shindig.apache.org>,
>> Date:   03/29/2011 04:35 PM
>> Subject:        RE: Shindig and webapp on same host/domain or not?
>>
>>
>>
>> Hmmm... Now I am seriously confused.  I'm not sure we are both using the
>> same terminology here.
>>
>> I want this
>>
>> Server 1 (domain x)
>> ------------------
>> Shindig Server
>>
>> Server 2 (domain y)
>> ------------------
>> A webapp that uses javascript gadget api to communicate with shindig
>> server and render gadgets into iframes
>>
>> The problem is that server 2 is trying to call itself for the gadget api
>> calls, since the container javascript is using relative paths.
>>
>> As Isaiah then mentions, he is trying to do a rewrite rule on server 2
>> to redirect the requests to the shindig server, however I suspect he'll
>> run into cross-domain issues here (as suggested by the common container
>> issue thread I referred to earlier).
>>
>> I'm sure there is just some configuration or concept I am missing here.
>>
>> doug
>>
>> -----Original Message-----
>> From: Kris Vishwanathan [mailto:v2kris@us.ibm.com]
>> Sent: Tuesday, March 29, 2011 3:27 PM
>> To: dev@shindig.apache.org
>> Cc: Davies,Douglas; dev@shindig.apache.org
>> Subject: Re: Shindig and webapp on same host/domain or not?
>>
>> Scenario three is a reasonable approach and that's how most of the
>> Social
>> networking sites run.
>>
>> Your deployment can look as below:
>>
>> Server1  (Domain X)
>> ------------
>>
>> Shindig Server
>> Common Container
>> index.html or your webpage that bootstraps container and your page etc..
>>
>>
>> Server 2 (Domain Y)
>> -------------
>> Your custom webapp
>> Other gadget apps
>>
>>
>> Hope it helps.
>>
>> Thanks and regards
>>
>> Kris Vishwanathan
>>
>>
>>
>>
>>
>>
>
>

Re: Shindig and webapp on same host/domain or not?

Posted by "Davies,Douglas" <da...@oclc.org>.
I'm pretty sure it's just using one of the relative urls from container.js, because I know that if I modified all the urls on the server side I then saw it making the request to the shindig server correctly. However that request fails because there is no post data in the request for gadget metadata. Not sure if that is a cross domain issue or something else. Hopefully someone will have an idea. Thanks. 

Doug

Sent from my iPhone

On Mar 29, 2011, at 9:18 PM, "Ryan J Baxter" <rj...@us.ibm.com> wrote:

> Hi Doug, I think you are right you should be striving for situation 3, at 
> least that is my understanding.  We have not yet tried to separate Shindig 
> and the web app so they are running on two different domains.  The only 
> thing I can suggest is just diving into the common container code and 
> figure out how it is figuring out the domain to use.  Off the top of my 
> head I cannot recall how the common container is doing this.  Mike 
> Hermanto may know more....
> 
> -Ryan
> 
> Email: rjbaxter@us.ibm.com
> Phone: 978-899-3041
> developerWorks Profile
> 
> 
> 
> From:   "Davies,Douglas" <da...@oclc.org>
> To:     Kris Vishwanathan/Fairfax/IBM@IBMUS, <de...@shindig.apache.org>, 
> Date:   03/29/2011 04:35 PM
> Subject:        RE: Shindig and webapp on same host/domain or not?
> 
> 
> 
> Hmmm... Now I am seriously confused.  I'm not sure we are both using the
> same terminology here.
> 
> I want this
> 
> Server 1 (domain x)
> ------------------
> Shindig Server
> 
> Server 2 (domain y)
> ------------------
> A webapp that uses javascript gadget api to communicate with shindig
> server and render gadgets into iframes
> 
> The problem is that server 2 is trying to call itself for the gadget api
> calls, since the container javascript is using relative paths.
> 
> As Isaiah then mentions, he is trying to do a rewrite rule on server 2
> to redirect the requests to the shindig server, however I suspect he'll
> run into cross-domain issues here (as suggested by the common container
> issue thread I referred to earlier).
> 
> I'm sure there is just some configuration or concept I am missing here.
> 
> doug
> 
> -----Original Message-----
> From: Kris Vishwanathan [mailto:v2kris@us.ibm.com] 
> Sent: Tuesday, March 29, 2011 3:27 PM
> To: dev@shindig.apache.org
> Cc: Davies,Douglas; dev@shindig.apache.org
> Subject: Re: Shindig and webapp on same host/domain or not?
> 
> Scenario three is a reasonable approach and that's how most of the
> Social
> networking sites run.
> 
> Your deployment can look as below:
> 
> Server1  (Domain X)
> ------------
> 
> Shindig Server
> Common Container
> index.html or your webpage that bootstraps container and your page etc..
> 
> 
> Server 2 (Domain Y)
> -------------
> Your custom webapp
> Other gadget apps
> 
> 
> Hope it helps.
> 
> Thanks and regards
> 
> Kris Vishwanathan
> 
> 
> 
> 
> 
> 


RE: Shindig and webapp on same host/domain or not?

Posted by Ryan J Baxter <rj...@us.ibm.com>.
Hi Doug, I think you are right you should be striving for situation 3, at 
least that is my understanding.  We have not yet tried to separate Shindig 
and the web app so they are running on two different domains.  The only 
thing I can suggest is just diving into the common container code and 
figure out how it is figuring out the domain to use.  Off the top of my 
head I cannot recall how the common container is doing this.  Mike 
Hermanto may know more....

-Ryan

Email: rjbaxter@us.ibm.com
Phone: 978-899-3041
developerWorks Profile



From:   "Davies,Douglas" <da...@oclc.org>
To:     Kris Vishwanathan/Fairfax/IBM@IBMUS, <de...@shindig.apache.org>, 
Date:   03/29/2011 04:35 PM
Subject:        RE: Shindig and webapp on same host/domain or not?



Hmmm... Now I am seriously confused.  I'm not sure we are both using the
same terminology here.

I want this

Server 1 (domain x)
------------------
Shindig Server

Server 2 (domain y)
------------------
A webapp that uses javascript gadget api to communicate with shindig
server and render gadgets into iframes

The problem is that server 2 is trying to call itself for the gadget api
calls, since the container javascript is using relative paths.

As Isaiah then mentions, he is trying to do a rewrite rule on server 2
to redirect the requests to the shindig server, however I suspect he'll
run into cross-domain issues here (as suggested by the common container
issue thread I referred to earlier).

I'm sure there is just some configuration or concept I am missing here.

doug

-----Original Message-----
From: Kris Vishwanathan [mailto:v2kris@us.ibm.com] 
Sent: Tuesday, March 29, 2011 3:27 PM
To: dev@shindig.apache.org
Cc: Davies,Douglas; dev@shindig.apache.org
Subject: Re: Shindig and webapp on same host/domain or not?

Scenario three is a reasonable approach and that's how most of the
Social
networking sites run.

Your deployment can look as below:

Server1  (Domain X)
------------

Shindig Server
Common Container
index.html or your webpage that bootstraps container and your page etc..


Server 2 (Domain Y)
-------------
Your custom webapp
Other gadget apps


Hope it helps.

Thanks and regards

Kris Vishwanathan







RE: Shindig and webapp on same host/domain or not?

Posted by "Davies,Douglas" <da...@oclc.org>.
Hmmm... Now I am seriously confused.  I'm not sure we are both using the
same terminology here.

I want this

Server 1 (domain x)
------------------
Shindig Server

Server 2 (domain y)
------------------
A webapp that uses javascript gadget api to communicate with shindig
server and render gadgets into iframes

The problem is that server 2 is trying to call itself for the gadget api
calls, since the container javascript is using relative paths.

As Isaiah then mentions, he is trying to do a rewrite rule on server 2
to redirect the requests to the shindig server, however I suspect he'll
run into cross-domain issues here (as suggested by the common container
issue thread I referred to earlier).

I'm sure there is just some configuration or concept I am missing here.

doug

-----Original Message-----
From: Kris Vishwanathan [mailto:v2kris@us.ibm.com] 
Sent: Tuesday, March 29, 2011 3:27 PM
To: dev@shindig.apache.org
Cc: Davies,Douglas; dev@shindig.apache.org
Subject: Re: Shindig and webapp on same host/domain or not?

Scenario three is a reasonable approach and that's how most of the
Social
networking sites run.

Your deployment can look as below:

Server1  (Domain X)
------------

Shindig Server
Common Container
index.html or your webpage that bootstraps container and your page etc..


Server 2 (Domain Y)
-------------
Your custom webapp
Other gadget apps


Hope it helps.

Thanks and regards

Kris Vishwanathan




Re: Shindig and webapp on same host/domain or not?

Posted by Kris Vishwanathan <v2...@us.ibm.com>.
Scenario three is a reasonable approach and that's how most of the Social
networking sites run.

Your deployment can look as below:

Server1  (Domain X)
------------

Shindig Server
Common Container
index.html or your webpage that bootstraps container and your page etc..


Server 2 (Domain Y)
-------------
Your custom webapp
Other gadget apps


Hope it helps.

Thanks and regards

Kris Vishwanathan



|------------>
| From:      |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |"Davies,Douglas" <da...@oclc.org>                                                                                                               |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| To:        |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |<de...@shindig.apache.org>                                                                                                                          |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Cc:        |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |"Davies,Douglas" <da...@oclc.org>                                                                                                               |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Date:      |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |03/29/2011 02:35 PM                                                                                                                               |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
|------------>
| Subject:   |
|------------>
  >--------------------------------------------------------------------------------------------------------------------------------------------------|
  |Shindig and webapp on same host/domain or not?                                                                                                    |
  >--------------------------------------------------------------------------------------------------------------------------------------------------|





I want to follow up with an earlier thread I had about webroot that has
taken me a different direction.  Sorry for starting a new thread, but
the listserv (or stupid entourage on the mac) is making it so that my
messages have been posted as 'daviesd' and not 'daviesd@oclc.org' and
this seems to be affecting the delivery and even the web view of the
archive.  Anyway...



I need some assistance as far as how shindig and the application webapp
using shindig to render embedded gadgets should be deployed.  I've
successfully gotten shindig running along-side my application webapp
that uses it.  Both projects are their own war file and deployed to the
same server (and thus same fully qualified domain name).  The shindig
war has been patched to use the /shindig web context and the application
war runs as root.  So /index.html is the page that includes the common
container javascript and references /shindig/gadgets, etc.



Is the desired deployment architecture:



1.       Add shindig as part of an existing webapp

2.       As a separate webapp on the same host/domain (as I've done)

3.       Or as a separate webapp on a totally different host/domain (so
the application runs at www.mydomain.com and shindig runs at
www.myshindig.com).



I'm able to get things to work fine with scenario 1 and 2.  Scenario 3
is where I have problems.  The common container doesn't seem to support
shindig on a different host/domain then the webapp using it.  If I
deploy shindig to a different host and run my webapp locally, I see it
trying to use http://localhost:8080/shindig/rpc instead of
http://www.myshindig.com/shindig/rpc).  It appears the javascript apis
are using relatives paths based on the current browser host.



On top of all this I've seen various threads about security concerns as
to where the gadget is running.  In scenarios 1 and 2 it possibly has
access to private information in the webapp that is using it.  In
scenario 3 it's running in an isolated shindig farm and any malicious
activity would only affect those servers but not the main application.



As I've said in the previous thread... I might be totally
misunderstanding this.  I really want to push for scenario 3, but if
it's not supported in the common container (or in shindig at all) as
this thread suggests



http://mail-archives.apache.org/mod_mbox/shindig-dev/201102.mbox/%3cAANL
kTingSX79SQAgrjFa4nPDHH4XGKSWOUN4MF_eH+Z1@mail.gmail.com%3e



then I'm willing to at least settle for scenario 2, assuming there are
not security concerns there.



Thanks,

Doug Davies

OCLC, Online Computer Library Catalog