Docstoc

Accessing Data Across Subdomains

Document Sample
Accessing Data Across Subdomains Powered By Docstoc
					Document Version: 1.0
Release Compatibility: 3.0
                                                                                                                         |1
Accessing Data Across Subdomains

                       This document describes how a TIBCO General Interface application
                       communicates with web servers across subdomains. There are two general
                       scenarios for accessing a TIBCO General Interface application, local provisioning
                       and remote provisioning. Local provisioning requires no configuration, if default
                       browser security settings are used. Remote provisioning requires either
                       configuring proxy communication or modifying default browser security settings.


Local Provisioning
                       With local provisioning, the application files and the TIBCO General Interface
                       runtime framework are located on the same machine as the web browser. When
                       the application is accessed, the browser loads required files into cache using a file
                       URL, for example file:\\C:\tibco\gi\GI_Builder.html. With the default
                       browser settings, there are no restrictions on communicating with web servers
                       outside the subdomain. Figure 1 illustrates the local provisioning scenario.

                       Figure 1 Local Provisioning

                                                                           Browser w/
                                                                          app in cache


                                                 Application
                                                   Files




                                                               Internet




                                             inside.mydomain.com rss.yahoo.com




                                                                          TIBCO General Interface Builder User’s Guide
2
    |

    Remote Provisioning
                            With remote provisioning, the application files and TIBCO General Interface
                            runtime framework are located on a web server. A browser on a remote machine
                            accesses the files using an HTTP URL and loads files into cache. When an HTTP
                            URL is used, default browser security settings prevent your application from
                            communicating with web servers outside the subdomain. Figure 2 illustrates the
                            remote provisioning scenario, before any configuration is performed.

                            Figure 2 Remote Provisioning—Before Configuration

                                                                              Browser w/
                                                                             app in cache

                                                                      WWW




                                                                  Internet




                                                        Application
                                                          Files
                                                            www.mydomain.com




                                                   inside.mydomain.com rss.yahoo.com

                            Figure 2 shows a TIBCO General Interface application deployed to
                            www.mydomain.com. Without configuration, the application can respond only to
                            www.mydomain.com. The browser prevents communication with other
                            subdomains such as inside.mydomain.com and rss.yahoo.com. However, the
                            same application in a local provisioning scenario can communicate directly with
                            web servers outside the subdomain.




    TIBCO General Interface Builder User’s Guide
                                                                        Accessing Data Across Subdomains 3
                                                                                                               |

Configuring Proxy Communication
                    To enable proxy communication, you configure both the application and the web
                    server where the application is deployed. This allows the web server to broker
                    interactions between the application and web servers outside the subdomain.
                    Figure 3 illustrates the remote provisioning scenario, with proxy services
                    configured.

                    Figure 3 Remote Provisioning—After Proxy Services Configuration

                                                                      Browser w/
                                                                     app in cache

                                                           WWW




                                                          Internet




                                                  Application
                                                    Files
                                                     www.mydomain.com




                                         inside.mydomain.com    rss.yahoo.com

  Configuring the   Steps for configuring the web server vary according to vendor.
          Server
                    •   Apache Install and configure the mod_proxy module. Then, use the
                        ProxyPass directive to route responses through the TIBCO General Interface
                        application domain server, such as www.mydomain.com, rather than a web
                        server outside the subdomain.
                        For details, see the Apache HTTP Server documentation at:
                        http://httpd.apache.org


                                                                TIBCO General Interface Builder User’s Guide
4
    |

                            •   Microsoft IIS Install and configure the Microsoft Internet Security and
                                Acceleration (ISA) Server. Write an ISAPI Filter to perform reverse-proxying
                                or use an equivalent third-party product. The software must intercept an
                                HTTP Request made to the TIBCO General Interface application domain
                                server, such as www.mydomain.com, copy the whole HTTP header packet,
                                change the HTTP Host header and perform a new HTTP Request using the
                                WinHttp API.
                                For details, see:
                                http://www.microsoft.com/isaserver/default.mspx
                            •   Custom Write a server process such as a servlet, .NET service, or web service
                                that acts as a proxy between the TIBCO General Interface application domain
                                server and other subdomains.

        Configuring the     The following JavaScript code can be added to an included JavaScript file in your
           Application      TIBCO General Interface Builder project. The script extends the HttpRequest
                            object, which handles all communication with external servers. If the called URL
                            is not the server where the application is deployed, the URL is reformatted and
                            sent back to the host server to use the existing proxy configuration.
                            //alias the existing 'open' method to a differently named method
                            //(e.g., '_open')

                            if(typeof(jsx3.HttpRequest.prototype._open) == "undefined")
                            jsx3.HttpRequest.prototype._open =
                            jsx3.HttpRequest.prototype.open;

                            //reformat the existing open command to modify the URL when running
                            //over HTTP/S (e.g., "live mode")
                            jsx3.HttpRequest.prototype.open = function(METHOD, strURL, bAsync,
                            strUser, strPass) {
                               //determine if the app is being served from the file system
                               //(dev-time) or http/s (run-time)
                               var wl = window.location;
                               if(wl.protocol.toUpperCase().indexOf("HTTP") == 0) {
                                  //get the base domain and protocol for the server hosting
                                  //this GI app
                                  var myDomain = wl.protocol + "//" + wl.host;

                                //since we're in HTTP/S mode, make sure that the URL being
                                //called is the same as the server hosting this page
                                //if not, we'll need to proxy it
                                var re = /^(http[s]*:)?\/\/([^\/]+)/i;
                                strURL.match(re);
                                var requestedDomain = RegExp.$1 + "//" + RegExp.$2;

                                if(myDomain != requestedDomain) {
                                   //strip off the protocol info
                                   var re = /^http[s]*:\/\//i;
                                   var theOtherServerPath = strURL.replace(re,"");




    TIBCO General Interface Builder User’s Guide
                                                                   Accessing Data Across Subdomains 5
                                                                                                            |
                              //combine the two together, providing a path that my server's
                              //proxy //passthrough can use
                              //Note: you may have additional path information to precede
                              //@theOtherServerPath resulting in a URL like: var strURL =
                              //myDomain + "/proxy/gi/" theOtherServerPath;
                              //This depends upon how the proxy passthrough paths have been
                              //configured
                              var strURL = myDomain + "/" + theOtherServerPath;
                          }
                      }

                      //call the original method (the one we aliased), now that strURL
                      //has been updated to use the proxy
                      this._open(METHOD, strURL, bAsync, strUser, strPass);
                      //return a handle to 'this' (as specified in the API docs, the
                      //'open' command returns a handle to self)
                      return this;

                 };


Modifying Browser Settings
                 An alternative to configuring proxy services is to modify browser security
                 settings on each client machine that accesses the application. When the
                 subdomain where the application is deployed is identified as a trusted site, the
                 browser allows direct communication with web servers outside the subdomain.
                 Figure 4 illustrates the remote provisioning scenario, with modified browser
                 settings.




                                                             TIBCO General Interface Builder User’s Guide
6
    |

                            Figure 4 Remote Provisioning—After Browser Configuration

                                                                              Browser w/
                                                                             app in cache

                                                                      WWW




                                                                  Internet




                                                        Application
                                                          Files
                                                            www.mydomain.com




                                                   inside.mydomain.com rss.yahoo.com
                            To modify browser settings on a client machine:
                            1. Exit TIBCO General Interface Builder.
                            2. In Internet Explorer, select Tools>Internet Options from the browser menu.
                                The Internet Options dialog displays.




    TIBCO General Interface Builder User’s Guide
                                                   Accessing Data Across Subdomains 7
                                                                                            |

3. Click the Security tab, then click the Trusted Sites zone.




4. Click the Custom Level button, enable the Access data sources across
   domains setting, then click OK.
5. Click the Sites button.




6. Type the name of the subdomain where the application is deployed in the
   Add this Web site to the zone field, then click OK.




                                             TIBCO General Interface Builder User’s Guide
8
    |




    TIBCO General Interface Builder User’s Guide

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:12
posted:1/7/2012
language:English
pages:8
jianghongl jianghongl http://
About