Open Bug 1805182 Opened 1 year ago Updated 1 month ago

HTTP 307 redirect forgets request’s body after initial redirection

Categories

(Core :: DOM: Navigation, defect, P3)

Firefox 102
defect

Tracking

()

ASSIGNED

People

(Reporter: interdist, Assigned: sefeng)

Details

Attachments

(1 file)

Steps to reproduce:

When a website issues a 307 Temporary Redirect for a POST request, Firefox is supposed to treat it as a new POST request with the original request parameters. These are preserved only for the initial redirection, and are lost after that.

Actual results:

Refreshing the page issues a GET request with the original request body being lost.

Expected results:

The POST request is reissued with the appropriate warning dialog box shown beforehand. This is the behavior of every other browser, including Internet Explorer.

The Bugbug bot thinks this bug should belong to the 'Core::Networking: HTTP' component, and is moving the bug to that component. Please correct in case you think the bot is wrong.

Component: Untriaged → Networking: HTTP
Product: Firefox → Core

I just verified that Firefox 107 on Android does in fact behave correctly, requesting the user to confirm the re-submission of the POST data. Therefore, the bug affects only the desktop version of Firefox.

Hi Reporter,

Could you provide a link for us to test?
Or could you try to capture a http log that shows this behavior?
Note that the log may contain some privacy, so you may want to send it to necko@mozilla.com.

Thanks.

Flags: needinfo?(interdist)

Hi Kershaw, I sent an HTTP log over email. It should show the initial POST request which receives a 307 response from the server, and is properly resubmitted to the new URL as a POST request. After I refresh the page (F5), a GET request is issued with the request parameters lost.

Thanks for the log, but I can't find anything wrong from networking point of view.
Looks like this is an issue in DOM, so I'll change the component.

Reporter, do you mind sharing the steps to reproduce here?
Thanks.

Component: Networking: HTTP → DOM: Navigation

(In reply to Kershaw Chang [:kershaw] from comment #5)

Steps to reproduce:

  1. Open a web page which contains a form submitted over POST to an endpoint responding with HTTP 307.
  2. Observe Firefox (on Desktop) being redirected to the new URL with the original form data.
  3. Refresh the new page via F5.
  4. The new URL is reloaded via GET request with no form data being resubmitted, instead of inquiring whether the user wants to repeat the submission and issuing a POST request.
Flags: needinfo?(interdist)

I needinfo myself to take a look

Severity: -- → S3
Flags: needinfo?(sefeng)
Priority: -- → P3

The postData should be carried over when we replace the
LoadingSessionHistoryEntry for the redirect.

Assignee: nobody → sefeng
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Flags: needinfo?(sefeng)
Pushed by sefeng@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7e708c1c9d9d
Fix the bug where postData is lost when the LoadingSessionHistoryEntry is replaced for redirect r=peterv
Backout by csabou@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/813138e96493
Backed out changeset 7e708c1c9d9d for causing SessionHistory related failures.

I'll need to update the patch.

Flags: needinfo?(sefeng)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: