简体   繁体   中英

What are the possible ways to fix problems when the server change from http to https?

I am having an issue with a calculation operation I am working on since the server changes from http to https.

I haven't change anything in the file of the functionality giving the issues, and actually I don't know what is going on because the console is not returning any errors.

In the Production Environment everything works properly because the protocol is http , but in the Staging ENV, that part of the app goes down and is not returning anything due to the change to a secured server.

if(window.location.href.indexOf("standalone") != -1) {
  var pid = 'HL:Tool:HLmisc:Calc;MortgageCalculator';
  var standalone = 'standalone=y&';
}else{
  var pid = 'MHE:Tool:HLPE;Tool_AffordabilitySnapshot';
  var standalone = 'standalone=&';
}           if(window.location.href.indexOf("standalone") != -1) {
  var pid = 'HL:Tool:HLmisc:Calc;MortgageCalculator';
  var standalone = 'standalone=y&';
}else{
  var pid = 'MHE:Tool:HLPE;Tool_AffordabilitySnapshot';
  var standalone = 'standalone=&';
}

$(".submitBtn").click(function(e){
  //alert(this.id);
  var valRes = AFFSNAP.form.validate();
  if(this.id === 'incomeSubmit' && valRes) {
    //alert('build income array');
    var income = new Array();
    income['pid'] = pid+'Tool_AffordabilitySnapshot';
    income['nm'] = this.name;
    income['hr'] = location.protocol+'//'+location.hostname+location.pathname+'?'+standalone+'step=expenses&agi='+$('#agi').val()+'&mni='+$('#mni').val();
    AFFSNAP.throwManualCMClickEvt(income);
  }
  if(this.id === 'expensesSubmit' && valRes) {
    var expenses = new Array();
    expenses['pid'] = pid+'Tool_AFS_Expenses';
    expenses['nm'] = this.name;
    expenses['hr'] = '//'+location.hostname+location.pathname+'?'+standalone+'step=debt&utilities='+$('#utilities').val()+'&communications='+$('#communications').val()+'&entertainment='+$('#entertainment').val()+'&dependents='+$('#dependents').val()+'&travel='+$('#travel').val()+'&savings='+$('#savings').val();
    AFFSNAP.throwManualCMClickEvt(expenses);
  }
  if(this.id === 'calculateSubmit' && valRes){
    var calculate = new Array();
    calculate['pid'] = pid+'Tool_AFS_Debt';
    calculate['nm'] = this.name;
    calculate['hr'] = '//'+location.hostname+location.pathname+'?step=results&creditCards='+$('#creditCards').val()+'&loans='+$('#loans').val();
    AFFSNAP.throwManualCMClickEvt(calculate);
    AFFSNAP.throwCMOnLoadEvt2();
  }
  return valRes;
});

that is the function where it takes some of the input values and do the calculation I need.

Any suggestions?

EDIT If you downvote, at least provide a reason so I can improve my answer. You are abusing of that functionality.

If you're referencing links within the same site, It's best to just reference paths relative to the root and omit the protocol & hostname. Your links would look like this:

<a href="/path/to/my/file.html?key1=val1">test</a>

The other way to handle it is to just remove the protocol altogether. This will allow it to be inherited from the current protocol. So your links would look like:

 <a href="//mydomain.com/path/to/my/file.html?key1=val1">test</a>

Whether your protocol is http or https, it will be automatically pre-pended to the href.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM