Thanks Stanton, It can work basically. But I found another problem with an
encode issue, as the endpoint is simply plus the host and path. For
example:
cfg[osapi.container.ServiceConfig.API_HOST] = "
http://localhost:8081/proxy?url=http//localhost:8080/cre/";
cfg[osapi.container.ServiceConfig.API_PATH] = "rpc"

Then the endpoint is :
http://localhost:8081/proxy?url=http//localhost:8080/cre/rpc

When adding the st information in jsonrpctransport.js:
url +="?st=";
url += encodeURIComponent(token)

Then the url become:
http://localhost:8081/proxy?url=http//localhost:8080/cre/rpc?st=
john.doe%3Ajohn.doe%3Aappid%3Acont%3Aurl%3A0%3Adefault

While it's wrong, there isn't any place to encode the whole url, the right
one should be :

http://localhost:8081/proxy?url=<http://localhost:8081/proxy?url=http//localhost:8080/cre/>
http%2F%2Flocalhost%3A8080%2Fcre%2Frpc%3Fst%3Djohn.doe%253Ajohn.doe%253Aappid%253Acont%253Aurl%253A0%253Adefault%20

So the core issue is that is there a place to indicate a proxy for the rpc
request.

On Tue, Dec 20, 2011 at 8:29 PM, Stanton Sievers <ssiev...@us.ibm.com>wrote:

> Hi Grace,
>
> You can also set osapi.container.ServiceConfig.API_HOST in your config
> object.
>
> For instance, in your example below you would set
> cfg[osapi.container.ServiceConfig.API_HOST] = "
> http://localhost:8081/proxy?url=http//localhost:8080/cre/";
>
> Then the API_PATH will be concatenated to the end of that and should build
> the request as you outlined below.
>
> Best regards,
> -Stanton
>
>
>
> From:   Grace <qiaoy...@gmail.com>
> To:     dev@shindig.apache.org,
> Date:   12/20/2011 06:09
> Subject:        How to config the rpc to a remote Shindig server
>
>
>
> While using the common container, we always use the following line:
>
>                   var cfg = {},
>
>            cfg[osapi.container.ServiceConfig.API_PATH] = CONTEXT_ROOT +
> "/rpc";
>            var cc = new osapi.container.Container(cfg);
>
> If we deploy Shindig on server 1(on port 8080), and the application on
> server 2(on port 8081). How to config the service api path.
>
> If I config it to a absolute url , such as "http://localhost:8080/cre/rpc
> ",
> then the final request will send to
> "
> http://localhost:8081http
> //localhost:8080/cre/rpc?st=john.doe%3Ajohn.doe%3Aappid%3Acont%3Aurl%3A0%3Adefault
> ",
> while the right url should be "
>
> http://localhost:8081/proxy?url=http//localhost:8080/cre/rpc?st=john.doe%3Ajohn.doe%3Aappid%3Acont%3Aurl%3A0%3Adefault
>
> ".
>
> Anyone know how to config it? Thanks!
>
>
>
>

Reply via email to