Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IE doesn't follow redirect, gives "Internet Explorer cannot display the webpage"

I have a form with a few fields. When you submit the form, the server responds with a redirect (HTTP 302).

When the form is submitted, if there is an <input type=file> field, IE doesn't follow the redirect, but instead gives an error: "Internet Explorer cannot display the webpage".

If there is no <input type=file> field, then it does follow the redirect as expected.

The HTTP 302 Response is exactly the same in both cases, differing only by the timestamp of the response.

I'm experiencing this in IE8 and IE9. (I haven't tried lower versions). Firefox, Chrome, Opera and Safari all follow the redirect as expected.

Notes:

  • The form has the attribute enctype="multipart/form-data".
  • This is happening over SSL
  • The redirect is not to a different protocol, host, or port than the URL the form POSTs to or is hosted on.
  • When I inspect HTTP traffic with Fiddler2, the issue disappears and IE behaves.
like image 590
nicholaides Avatar asked Aug 04 '11 20:08

nicholaides


People also ask

How do I fix page Cannot be displayed?

To resolve this issue, install the most recent cumulative security update for Internet Explorer. To do this, go to Microsoft Update.

How do I fix page Cannot be displayed in Internet Explorer Windows XP?

If you are running Windows XP you can simply refresh your TCP/IP by clicking on Start then Run and then typing command and then click OK. In the black command prompt type in netsh int ip reset resetlog. txt and then press ENTER on your keyboard.

How do I get rid of Internet Explorer redirect?

Set the RedirectSitesFromInternetExplorerRedirectMode policy to Enabled AND then in the dropdown under Options: Redirect incompatible sites from Internet Explorer to Microsoft Edge, select Disable. This setting will stop redirecting as soon as the policy takes effect.


2 Answers

The question is 3 years old, but I recently ran into this problem myself and didn't find the correct answer anywhere. The answer marked as accepted here doesn't really answer anything.

What made a difference for me was adding the following header to the 302 response:

 Connection: close

I was redirecting to another site with full URL, and it looks like IE is trying to optimize connections by sending subsequent requests over the same TCP stream without re-opening it, but is not smart enough to figure out that the site is different without explicit "Connection" instruction in the header.

This happens in at least IE10 and IE11, and none of the other browsers has this problem.

like image 54
Cozzamara Avatar answered Oct 23 '22 18:10

Cozzamara


Is your redirect to a partial URL or a complete URL (with host, protocol, etc.)? I have seen plenty of examples in PHP where a redirect with 302 that does not have a complete http://server.dom/path/to/file in it will be ignored or mangled by IE. In Rails, this can be the difference between foo_path and foo_url in the router.

like image 38
Walter Avatar answered Oct 23 '22 18:10

Walter