Why does Ajax works fine in HTTP but not in HTTPS in FireFox?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sekku

    Why does Ajax works fine in HTTP but not in HTTPS in FireFox?

    When we are directly access the application from Application server(localhos t).I am getting the correct response.

    This is URL
    http://localhost:27110/vcm-ui/request?vui.req uest.transport= json&vui.respon se.transport=js on&vui.request =[{%22id%22%3A0.8 391487769614959 %2C%22action.ke y%22%3A%22messa ge%22%2C%22even t%22%3A%22multi ple%22%2C%22con tent%22%3A{%22c om.vignette.ui. framework.modul e.id%22%3A%22ta sk%22%2C%22com. vignette.ui.fra mework.module.v iew.mode%22%3A% 22table%22%2C%2 2baseName%22%3A %22com.vignette .ui.vcm.l10n.mo dule.TaskResour ce%22%2C%22keys %22%3A%22accept .action.label\t accept.action.d escription\trej ect.action.labe l\treject.actio n.description\t approve.action. label\tapprove. action.descript ion\tmenu.tour. label\tmenu.tou r.description\t menu.tour.url%2 2}}%2C]%20HTTP/1.1

    Response
    /*{xapi:{metadat a:{"user": "?","status ": "ok","reque st": "http://localhost:27110/vcm-ui/request"},conta iner:{"type": "vui","id": "0.839148776961 4959",data:[{"type": "vuiError","mes sage": "Current user is not authorized to perform the requested action.","id": "0.839148776961 4959","content" : "", "end": "---end-marker---"}]}}}*/

    When we are trying to access from Webserver(https proxy) by redirecting to Application.I am getting encrypted response.

    The URL for Access Webserver is

    https://qa2.rpvgn.com/vcm-ui/request?vui.req uest.transport= json&vui.respon se.transport=js on&vui.request =[{%22id%22%3A0.8 391487769614959 %2C%22action.ke y%22%3A%22messa ge%22%2C%22even t%22%3A%22multi ple%22%2C%22con tent%22%3A{%22c om.vignette.ui. framework.modul e.id%22%3A%22ta sk%22%2C%22com. vignette.ui.fra mework.module.v iew.mode%22%3A% 22table%22%2C%2 2baseName%22%3A %22com.vignette .ui.vcm.l10n.mo dule.TaskResour ce%22%2C%22keys %22%3A%22accept .action.label\t accept.action.d escription\trej ect.action.labe l\treject.actio n.description\t approve.action. label\tapprove. action.descript ion\tmenu.tour. label\tmenu.tou r.description\t menu.tour.url%2 2}}%2C]%20HTTP/1.1

    The Response I am getting is

    ������� �� ���������}��N �0D��J추6��+ �m�4Vd;]�# ʿcGp��mfwg���� �5�C��"SD�F�' Y���)�l � #?0OF�;M�ͫ�� |-�.8���ܹ:Y�Y�.x ���������^��W �C{85�˹=N�c+�� ���� Q�r#ܶ�s" BϢ� �, ��~a/8� �=�<��!� ����%�;�����D ���u�U�F�l���N �)��R��I�e��� ��

    Code Used for making a Ajax request is

    Code:
    		var xhr;
    		if (window.XMLHttpRequest) {
    			xhr = new XMLHttpRequest();
    		}else if(window.ActiveXObject){
    			xhr = new ActiveXObject("Microsoft.XMLHTTP");
    		}
    		// Open the socket
    		// Passing null username, generates a login popup on Opera (#2865)
    		alert("The URL is "+s.url);
    		if( s.username )
    			xhr.open(type, s.url, s.async, s.username, s.password);
    		else
    			xhr.open(type, s.url, s.async);
    
    		// Need an extra try/catch for cross domain requests in Firefox 3
    		try {
    			// Set the correct header, if data is being sent
    			if ( s.data )
    				xhr.setRequestHeader("Content-Type", s.contentType);
    
    			// Set the If-Modified-Since header, if ifModified mode.
    			if ( s.ifModified )
    				xhr.setRequestHeader("If-Modified-Since",
    					vQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" );
    
    			// Set header so the called script knows that it's an XMLHttpRequest
    			xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest");
    			xhr.setRequestHeader("Method", "GET "+s.url+" HTTP/1.1");
    
    			// Set the Accepts header for the server, depending on the dataType
    			xhr.setRequestHeader("Accept", s.dataType && s.accepts[ s.dataType ] ?
    				s.accepts[ s.dataType ] + ",application/json, */*" :
    				s.accepts._default );
    		} catch(e){}
    This working fine in IE 6 but not in FireFox and IE 7

    Please help in solving it.
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Perhaps you need to set the character encoding on the server-side. Check the page output without using Ajax, i.e. access the URL directly, and see the output.

    Comment

    • sekku
      New Member
      • Oct 2010
      • 1

      #3
      gzip compression done by web server was not supported by IE7 and FF.
      So we need to remove the compression from server level configuration, and it worked.

      But by removing compression may affect the performance.
      So I am looking for better solution,that browser understand gzip compression.

      Comment

      Working...