-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Catch ajax errors globally when server goes away or other errors occur #16392
Comments
Can not find the issue anymore, so maybe we just discussed it and never created it. |
I agree. When uploading a new version of an app, I always have to check the network tab to see if I'm getting 503 errors because the app doesn't stop working when it gets them. |
@PVince81 is there a solution at hand? Something we can fix for 8.2? or 9.0? |
@DeepDiver1975 the only solution I know of is what you implemented yourself: #16783 |
This issue will fall off 8.2 if not resolved by 6 Oct |
@butonic the current webdav approach will redirect if a 401 error is returned by the server. |
Which does not help wit 30x redirects that are created by apache redirecting Ajax calls to the i do when the shibboleth session lifetime has ended. Furthermore, it seems jQuery sees Ajax redirects as having status 0 for whatever reason. Webdav is only half the solution. Imo all oc Ajax calls need to handle redirects, because we cannot anticipate what apache or nginx or proxy or firewall or file firewall rule sits between the browser and the server and might redirect us... |
Then we might need to global solution proposed by @DeepDiver1975 too. |
@butonic is there a way to simulate this on a regular Apache server ? Setup a misconfigured apache module ? |
hm, adding a conditional Redirect rule for an Ajax route to .htaccess should do it. |
Any docs I could look at ? (I have no clue how to do this, sorry 😄) |
in the .htaccess mod_rewrite section add a
to the end. That will redirect the ajax call when fetching the shares after clicking on the share Icon in the filelist. Probably a better idea to Redirect to a local page. You will get followup errors in the console and the spinner will never finish spinning. |
Cool, thanks. |
So far it seems that ajax calls automatically follows redirects. Doing some research, maybe there are workarounds: http://stackoverflow.com/questions/9177252/detecting-a-redirect-in-jquery-ajax |
This says it is impossible: http://stackoverflow.com/a/2573589 But one trick proposed here http://stackoverflow.com/a/24715958 is that we set a specific custom header in ALL our ajax responses. Then if the jQuery ajax response doesn't contain it, then it means it was a redirect or not an ajax answer (but a plain page instead). This reminds me of the old topic about detecting whether we're getting a full page as a response by checking if Content-Type was JSON or XML: #15357 (or not 100% that) |
@butonic what page does a SSO fail redirects to ? ownCloud's login page ? |
the redirect goes to the web page of the idp - a redirect to some url out there in the wild |
Hmmmm... and if that URL isn't in the same domain we might even get a cross-domain fail |
@PVince81 yes, cors needs to be set in the config to allow ajax to the idp to make this detectable without Errors. |
Ok, so this means we need to not only detect 503, 401 but also detect:
|
I'm first going to revive #16783. |
Fixed by #16783 |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Whenever the following happens:
if it happens during an ajax call, the error isn't always caught and processed properly, so the user might see strange behavior.
One idea would be to implement global ajax handlers using https://api.jquery.com/category/ajax/global-ajax-event-handlers/ and provide a default mechanism for when 503 is returned or whenever the user gets logged out.
It might not work for all apps, so apps might still need to do special handling in other cases.
@nickvergessen you had a ticket about the files app looping if I remember well ? Please link it here.
@butonic @blizzz did some preliminary work on catching errors
CC @LukasReschke FYI
The text was updated successfully, but these errors were encountered: