Anyone else having issues with Firefox _not_ reloading the page you redirect to from the server when you use a 303 redirect (POST/redirect/GET). Seeing this in Firefox 105.0.1 on Linux (Fedora Silverblue 37).
Both WebKit (GNOME Web) and Chromium load the page being redirected to from the server via a GET request as they should. Firefox makes no request.
I even tried setting the Cache-Control header to 'no-store' on the original page request, but still the same behaviour.
Thoughts?
To add to the oddness, I’m only seeing this from a POST route where I perform an await on a fetch() and JSON deserialisation in the route.
On another route where I’m not performing a fetch on the server, Firefox dutifully carries out a GET request after my 303 redirect.
*sigh* :)
Well, mystery solved: it was my development-time hot reload script.
For some reason (going to look into that next), on Firefox, when you do a POST, the WebSocket connection is being broken but then reconnected while the POST load is still in progress. My reload script detects reconnections and reloads the page.
This behaviour, correctly, doesn’t manifest in WebKit and Chrome.
I believe it’s a bug with how WebSockets are handled during POST requests in Firefox but have to debug it some more.
So the issue is this: when you carry out a form POST from Firefox, it disconnects any WebSocket connections that might exist.
WebKit and Chrome do not.
This feels like a bug to me. (Or at least, it should be brought in line with the behaviour of the other two browsers.)
Looks like it’s this issue that the Socket.io folks also ran into a little while back:
And a variation of this fix should do the trick for me too:
https://github.com/socketio/engine.io-client/commit/ed48b5dc3407e5ded45072606b3bb0eafa49c01f
PS. (In case anyone’s wondering) It did :)
(Basically, removing the event listeners from the socket on unbeforeunload and closing the socket/cleaning up. I mean, not a bad thing to do in any case, I guess, but not necessary for any other browser but Firefox at the moment. The others just work as they should on this.)