Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 694
Darshit Patel Avatar asked Dec 28 '17 16:12

Darshit Patel


People also ask

How do I change the MIME type of a file?

In the Connections pane, go to the site, application, or directory for which you want to add a MIME type. In the Home pane, double-click MIME Types. In the MIME Types pane, click Add... in the Actions pane. In the Add MIME Type dialog box, add the file name extension and MIME type, and then click OK.


1 Answers

TL;DR - you will need to change the mime types.

This problem appears when the requests expected type is different from the response-content type (as indicated by the headers). The correct solution would be to make response and request headers compatible with each other. That means, the call you make "through a script tag" should be changed to have the same accept header as the response's content-type header.

Also, take a look at the documentation:

nosniff Blocks a request if the requested type is "style" and the MIME type is not "text/css", or "script" and the MIME type is not a JavaScript MIME type.

See here.

I see that this URL: https://nirma.myshopify.com/apps/GeoShippingBar/geoShippingBarProxy has this content-type: Content-Type:text/html; charset=utf-8 which is not javascript-mime-type.

like image 107
Mindaugas Bernatavičius Avatar answered Oct 05 '22 07:10

Mindaugas Bernatavičius