Bug 242931 - refreshing a POSTed page shows multiple warning alerts when the POST refresh has redirections
Summary: refreshing a POSTed page shows multiple warning alerts when the POST refresh ...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: History (show other bugs)
Version: Safari 15
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2022-07-19 20:01 PDT by Juny Tse
Modified: 2022-07-26 20:02 PDT (History)
6 users (show)

See Also:


Attachments
A NodeJS script to run a web server to demo the issue (1.02 KB, application/x-javascript)
2022-07-19 20:01 PDT, Juny Tse
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Juny Tse 2022-07-19 20:01:05 PDT
Created attachment 461030 [details]
A NodeJS script to run a web server to demo the issue

When the current page comes from a POST request and we refresh the page, an alert "Are you sure you want to send a form again?" will be shown.
However, if we click "Yes" and the resent POST request happens to have redirections (for example, login is requested), each of the redirected page will trigger the "Are you sure you want to send a form again?" alert, even it is a GET request.

To reproduce:
1. use attached nodejs file reproduce.js, run `node reproduce.js`.
2. use Safari to visit http://localhost:8000/
3. click "do POST" button in the page, it submits a POST form, renders a new page http://localhost:8000/do,
4. refresh the web page, "Are you sure you want to send a form again?" alert is shown, click "Yes" to resend the POST request, the response is a 302 redirection to http://localhost:8000/redirect
5. issue here: subsequent redirect request "GET http://localhost:8000/redirect" also trigger "Are you sure you want to send a form again?" alert.

Note that Safari dev inspector cannot show the redirections in step #4 #5, you may need tool like Fiddler/Charles.
Comment 1 Radar WebKit Bug Importer 2022-07-26 20:02:15 PDT
<rdar://problem/97642567>