shindig-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ali Hamdi (JIRA)" <j...@apache.org>
Subject [jira] Created: (SHINDIG-1250) Proxy URL is not correct when using Shindig in an SSL environment
Date Tue, 22 Dec 2009 14:54:31 GMT
Proxy URL is not correct when using Shindig in an SSL environment
-----------------------------------------------------------------

                 Key: SHINDIG-1250
                 URL: https://issues.apache.org/jira/browse/SHINDIG-1250
             Project: Shindig
          Issue Type: Bug
          Components: Javascript 
         Environment: Shindig 0.8.1-1-r719456
            Reporter: Ali Hamdi


I configured my Tomcat to use SSL environment.(HTTPS)
I have an RSS gadget which gets contents from external feeds.
When debugging, I found that the proxy URl was incorrect in file *shindig-features-0.8.1-1-r719456/features/core.io/io.js*

proxyUrl=http://localhost:8443/GadgetServer which contains http instead of https and that
returned me this error 
{code}
'Access to restricted URI denied" code: "1012'
{code}
The origin of this error was :
{code:javascript}
function makeXhrRequest(realUrl, proxyUrl, callback, paramData, method,
      params, processResponseFunction, opt_contentType) {
    var xhr = makeXhr();
    xhr.open(method, proxyUrl, true);// this code generates the exception
    if (callback) {
      xhr.onreadystatechange = gadgets.util.makeClosure(
          null, processResponseFunction, realUrl, callback, params, xhr);
    }
    if (paramData != null) {
      xhr.setRequestHeader('Content-Type', opt_contentType || 'application/x-www-form-urlencoded');
      xhr.send(paramData);
    } else {
      xhr.send(null);
    }
  }
{code}

I fixed it by adding this code which find out which HTTP protocol is used to generate the
right HTTP request in *makeRequest* function:
{code:javascript}
makeRequest : function (url, callback, opt_params) {
      // TODO: This method also needs to respect all members of
      // gadgets.io.RequestParameters, and validate them.

      var params = opt_params || {};

      var httpMethod = params.METHOD || "GET";
      var refreshInterval = params.REFRESH_INTERVAL;

 ......................................

      var proxyUrl = config.jsonProxyUrl.replace("http:", document.location.protocol).replace("%host%",
document.location.host);//the line was fixed this way 
// it will be better to use replace("%protocol%", document.location.protocol) and add %protocol%
to the proxyUrl template
{code}


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message