Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Post-Redirect-Get with Internet Explorer

I have a web page that implements the post/redirect/get pattern to avoid double posts in a simple CRUD application.

The intended request/response sequence here is:

  1. browser sends data via POST
  2. server modifies the DB, responds with status 302 Moved Temporarily and a Location header
  3. browser follows the redirect via GET
  4. server responds with the updated page

This is how it is supposed to work – and it does, in Chrome for example.

Internet Explorer 9, however, sends step 3 as a POST, too (including the complete set of form data!). Why? What should I do to make it use GET?

I should add that apart from the query string the redirect goes to the same location as the form target.

I've tried:

  • all available of rendering modes (IE7, IE8, IE9, Quirks, Standards, Compat)
  • a full DOCTYPE
  • a relative URL or an absolute one in the Location header
  • HTTP Status 303 (just to see if that makes any difference)
like image 380
Tomalak Avatar asked Mar 28 '12 16:03

Tomalak


People also ask

Can I still use Internet Explorer after 2022?

After 25+ years of helping people use and experience the web, Internet Explorer (IE) is officially retired and out of support as of today, June 15, 2022. To many millions of you, thank you for using Internet Explorer as your gateway to the internet.

How do I stop ie11 from redirect to Edge?

How Do I Stop Internet Explorer from Redirecting to Edge? Launch Microsoft Edge and go to Settings. Navigate to Default browser, and locate Let Internet Explorer open sites in Microsoft Edge. Set this option to Never.


2 Answers

The correct status code if you want a GET is 303, although 301 and 302 will also do what you want in common browsers.

If this is not working, something else probably is wrong. An HTTP trace would be helpful for finding what is wrong.

like image 153
Julian Reschke Avatar answered Sep 22 '22 19:09

Julian Reschke


I'm not sure but it seems like IE9 doesn't actually sent "POST" after redirect 30x - it just displays it in his internal debugger.

like image 35
alex_1948511 Avatar answered Sep 20 '22 19:09

alex_1948511