You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, this issue is caused by Pjax revisits as described here: #342
The problem is worse however. For example, when user uploads too large file, the server response "413 Request Entity Too Large" should be displayed to user. For example, this is returned by nginx:
<html>
<head><title>413 Request Entity Too Large</title></head>
<body>
<center><h1>413 Request Entity Too Large</h1></center>
<hr><center>nginx</center>
</body>
</html>
But now Pjax tries to revisit that URL and that will produce this error instead:
Oops! An Error Occurred
The server returned a "405 Method Not Allowed".
The core of the problem is that Pjax makes additional request without user consent (revisit).
To reproduce
Make any form POST request to URL in a way that generates status code >=400 and where the URL is POST-only
See the error message
The error message is wrong (Pjax tries to GET that URL which is POST-only)
Expected behavior
Correct server error message should be displayed in the browser.
Pjax should not repeat a request if there is HTML content to show in the first response.
Possible solutions
Pjax probably checks mime type or something in header or status code to decide if to repeat request.
One solution to this problem is to check if there is any HTML content even if there is error status and then NOT repeat request (revisit) and instead run document.write(htm_error). Or user-provided handler for error output can be run (where I would call document.write and show the HTML of the error message).
The text was updated successfully, but these errors were encountered:
Describe the bug
Hi, this issue is caused by Pjax revisits as described here: #342
The problem is worse however. For example, when user uploads too large file, the server response "413 Request Entity Too Large" should be displayed to user. For example, this is returned by nginx:
But now Pjax tries to revisit that URL and that will produce this error instead:
The core of the problem is that Pjax makes additional request without user consent (revisit).
To reproduce
Expected behavior
Possible solutions
Pjax probably checks mime type or something in header or status code to decide if to repeat request.
One solution to this problem is to check if there is any HTML content even if there is error status and then NOT repeat request (revisit) and instead run document.write(htm_error). Or user-provided handler for error output can be run (where I would call document.write and show the HTML of the error message).
The text was updated successfully, but these errors were encountered: