To follow these instructions you'll need a working copy of Apache Rave up and running under Tomcat 6. Please see the Installing Rave page for instructions on how to get up and running.

Enabling Locked Domain Support in Apache Rave

These instructions demonstrate how to get Apache Shindig locked domain support up and running in Apache Rave. Locked domains take advantage of the web browsers domain-based sandboxing policies to isolate gadgets from each other and the main container page. The Shindig mailing list is a good source of information for more details regarding locked domains.

Enabling locked domain support within Apache Rave is achieved via a combination of DNS and Shindig configuration changes. To fully support locked domain in a production environment you'll likely need to setup and configure your locked domain with wildcard DNS (otherwise you'd have to create manual DNS entries for every single gadget that you want to run on a locked domain). For the purposes of experimenting with locked domain however just adding entries to the "hosts" file for the gadgets on a default Apache Rave page should be sufficient. The Shindig configuration changes required are enabling locked domain support in the top level Shindig configuration and then configuring the individual Shindig container via the container.js file.

The sample locked domain we'll use here will be "".

The default locked domain implementation within Shindig generates locked domain URL's by taking a hash of the gadget specification URL and pre-pending it onto the configured locked domain suffix. Here are the locked domain entries that were added to my local "hosts" file to support the default gadgets on an Apache Rave page at the time this documentation was written:

For the Shindig configuration changes please refer to the patch generated from my local changes below. With these changes in place you should be able to fire up Apache Rave, access the default page as one of the sample users and see the locked domains being utilized in the gadget iframe URL's.

Complete diff of modified files follows

    Index: rave-project/rave-shindig/src/main/webapp/WEB-INF/classes/containers/default/container.js
    --- rave-project/rave-shindig/src/main/webapp/WEB-INF/classes/containers/default/container.js   (revision 1228369)
    +++ rave-project/rave-shindig/src/main/webapp/WEB-INF/classes/containers/default/container.js   (revision )
    @@ -59,15 +59,15 @@
     "gadgets.parent" : null,

     // Should all gadgets be forced on to a locked domain?
    -"gadgets.uri.iframe.lockedDomainRequired" : false,
    +"gadgets.uri.iframe.lockedDomainRequired" : true,

     // DNS domain on which gadgets should render.
     // Default Uri config: these must be overridden - specified here for testing purposes
    -"gadgets.uri.iframe.unlockedDomain": "${Cur['defaultShindigTestAuthority']}",
    +"gadgets.uri.iframe.unlockedDomain": "localhost:8080",
     // When setting up the server to enable locked domains, you should set this to something that does not
     // attempt to use the authority at all.  Ideally it would be another hostname that points to this server.
     // Example: unlockedDomain="" lockedDomainSuffix=""
    -"gadgets.uri.iframe.lockedDomainSuffix": "${Cur['defaultShindigTestAuthority']}",
    +"gadgets.uri.iframe.lockedDomainSuffix": "",

     // Origins for CORS requests and/or Referer validation
     // Indicate a set of origins or an entry with * to indicate that all origins are allowed
    @@ -84,11 +84,8 @@
     // jsUriTemplate will have %host% and %js% substituted.
     // No locked domain special cases, but jsUriTemplate must
     // never conflict with a lockedDomainSuffix.
    -"gadgets.jsUriTemplate" : "http://%host%${CONTEXT_ROOT}/gadgets/js/%js%",
    +"gadgets.jsUriTemplate" : "http://${Cur['gadgets.uri.iframe.unlockedDomain']}{CONTEXT_ROOT}/gadgets/js/%js%",

    -"" : "",
    -"gadgets.uri.js.path" : "${CONTEXT_ROOT}/gadgets/js",
     // Callback URL.  Scheme relative URL for easy switch between https/http.
     "gadgets.uri.oauth.callbackTemplate" : "//%host%${CONTEXT_ROOT}/gadgets/oauthcallback",

    @@ -124,16 +121,16 @@

     // Default Js Uri config: also must be overridden.
    -"": "//${Cur['defaultShindigTestAuthority']}",
    +"": "//${Cur['gadgets.uri.iframe.unlockedDomain']}",
     "gadgets.uri.js.path": "${CONTEXT_ROOT}/gadgets/js",

     // Default concat Uri config; used for testing.
    -"" : "${Cur['defaultShindigProxyConcatAuthority']}",
    +"" : "${Cur['gadgets.uri.iframe.unlockedDomain']}",
     "gadgets.uri.concat.path" : "${CONTEXT_ROOT}/gadgets/concat",
     "gadgets.uri.concat.js.splitToken" : "false",

     // Default proxy Uri config; used for testing.
    -"" : "${Cur['defaultShindigProxyConcatAuthority']}",
    +"" : "${Cur['gadgets.uri.iframe.unlockedDomain']}",
     "gadgets.uri.proxy.path" : "${CONTEXT_ROOT}/gadgets/proxy",

     //Enables/Disables feature administration
    @@ -153,7 +150,7 @@
         // Note: /proxy is an open proxy. Be careful how you expose this!
         // Note: Here // is replaced with the current protocol http/https
        //"proxyUrl" : "//%host%${CONTEXT_ROOT}/gadgets/proxy?container=%container%%rewriteMime%&refresh=%refresh%&gadget=%gadget%/%rawurl%",
    -    "proxyUrl" : "//%host%${CONTEXT_ROOT}/gadgets/proxy?container=%container%&refresh=%refresh%&url=%url%%rewriteMime%",
    +    "proxyUrl" : "//${Cur['gadgets.uri.iframe.unlockedDomain']}${CONTEXT_ROOT}/gadgets/proxy?container=%container%&refresh=%refresh%&url=%url%%rewriteMime%",
         "jsonProxyUrl" : "//%host%${CONTEXT_ROOT}/gadgets/makeRequest"
       "views" : {
    Index: rave-project/rave-shindig/src/main/resources/
    --- rave-project/rave-shindig/src/main/resources/    (revision 1228398)
    +++ rave-project/rave-shindig/src/main/resources/    (revision )
    @@ -96,7 +96,7 @@

     # If enabled here, configuration values can be found in container configuration files.

     # TODO: This needs to be moved to container configuration.