Search code examples
javascriptinternet-explorerproxymime

MIME type issue in InternetExplorer using Proxy


In Internet Explorer, the requested url is being blocked due to mime type mismatch. The scenario is that request is being sent from the client to the destination server through proxy server. Suppose we have A(Client), B(Proxy Server), C(Destination Server). The request goes from A(client) to B(Proxy server) and from B(Proxy server) to C(Destination server). Similarly the response also comes from C(Destination Server) to B(proxy server) and from B(proxy server) to A(client) from where the request was initiated. Now the problem is that the response Content-type is "application/liquid" but the client fires the request using the "script src=proxyserver/test" , so the excepted Content-Type for response becomes "text/javascript". It is not allowed to change the Content-type of response from "application/liquid" of the destination server. The whole scenario works perfectly in all the other browser and the response is easily accessible. However in IE as we are getting the error as "request blocked due to mime type mismatch " . So can anyone provide the solution that how could we make it work ? Below is the screenshot of the error.

enter image description here


Solution

  • You need to create a script , an external script which will give the call to the desired code using a ajax call or xmlhttprequest , where you will need to set the accept header so the desired mime type. So from the client it will call that external script using the script tag which will get executed through the proxy server and which will further give the call to the actual data and recieve its response and send back to client. But as it will call the script, by default header would return as text/javascript and the error will get resolved.