Skip to content
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

Heartbeat should respond 404, not 410, when session expired #4417

Closed
vaadin-bot opened this issue Sep 6, 2013 · 7 comments · Fixed by #11556 or #11859
Closed

Heartbeat should respond 404, not 410, when session expired #4417

vaadin-bot opened this issue Sep 6, 2013 · 7 comments · Fixed by #11556 or #11859
Labels
Milestone

Comments

@vaadin-bot
Copy link
Collaborator

Originally by @jdahlstrom


HeartbeatHandler currently sends 410 Gone if the session is expired. This is arguably semantically wrong, as a user agent is within its rights to assume that the resource uniquely identified by the URI (and only the URI - cookies don't matter) will never be available again and any future requests to the same URI should not be made. A 404 Not Found should be returned instead.


Imported from https://dev.vaadin.com/ issue #12526

@vaadin-bot
Copy link
Collaborator Author

Originally by @Artur-


Or maybe 403 (forbidden) instead. 404 is easily confused with a server configuration problem.

@vaadin-bot
Copy link
Collaborator Author

Originally by sre


I would also recommend to change 410 to 403. We have a lot of problems with the PublishedFileHandler, because the browser (at least Chrome) caches 410 responses. Now, if you have some parts of your widgetset rely on jquery or other javascript libraries, sometimes the cached 410 is returned even after a new session has been created, which lets some of your widgets just disappear. The same happens sometimes for a login iframe connector resource.
We use Vaadin Push, probably this contributes to the problem.

Another problem (which I suppose cannot be solved with websockets): There are also cases that http 404 is returned for the /PUBLISHED files:

  • Establish a UI with websocket
  • Delete the browser cache and cookies - the websocket connection still exists
  • Next request tries to load a /PUBLISHED javascript, the request establishes a new session, but the published files were not initialized yet, because getInitialUidl was not called for this session, so it gives 404

@vaadin-bot vaadin-bot added the bug label Dec 10, 2016
@stale
Copy link

stale bot commented Mar 20, 2018

Hello there!

It looks like this issue hasn't progressed lately. There are so many issues that we just can't deal them all within a reasonable timeframe.

There are a couple of things you could help to get things rolling on this issue (this is an automated message, so expect that some of these are already in use):

  • Check if the issue is still valid for the latest version. There are dozens of duplicates in our issue tracker, so it is possible that the issue is already tackled. If it appears to be fixed, close the issue, otherwise report to the issue that it is still valid.
  • Provide more details how to reproduce the issue.
  • Explain why it is important to get this issue fixed and politely draw others attention to it e.g. via the forum or social media.
  • Add a reduced test case about the issue, so it is easier for somebody to start working on a solution.
  • Try fixing the issue yourself and create a pull request that contains the test case and/or a fix for it. Handling the pull requests is the top priority for the core team.
  • If the issue is clearly a bug, use the Warranty in your Vaadin subscription to raise its priority.

Thanks again for your contributions! Even though we haven't been able to get this issue fixed, we hope you to report your findings and enhancement ideas in the future too!

@stale stale bot added the Stale Stale bot label label Mar 20, 2018
@Emmenemoi
Copy link

This cached headers following a 410 on /APP/PUBLISHED/* is a real problem for loading js: there's no error (session exists) but scripts are not loaded because of 410 being cached.

This still exists in 8.5.2.

@stale stale bot removed the Stale Stale bot label label Feb 18, 2019
@mvysny
Copy link
Member

mvysny commented Apr 15, 2019

I agree with changing that to 403, maybe with an error message of "no session" or such. Anything else than 410 GONE PERMANENTLY (since that's clearly not the case).

The workaround is to move .js files to the VAADIN/ folder and using vaadin:// URLs to reference them.

@edler-san
Copy link
Contributor

403 would be semantically wrong as well since no authorisation takes place. 404 is the right code. As per RFC: The 404 (Not Found) status code indicates that the origin server did not find a _current_ representation for the target resource (emphasis mine) - which is exactly what happens.

I think more relevant would be to add response.setHeader("Cache-Control", "no-cache"); to handleSessionExpired in
https://github.com/vaadin/framework/blob/master/server/src/main/java/com/vaadin/server/communication/HeartbeatHandler.java

@ZheSun88 ZheSun88 added this to the 8.9.0 milestone May 2, 2019
ZheSun88 pushed a commit that referenced this issue May 2, 2019
…10 and added the no-cache parameter to the reply. (#11556)

* Changed the handleSessionExpired logic to return a 404 instead of a 410. Also added the no-cache parameter to the reply.
See #4417 for discussion.
ZheSun88 pushed a commit that referenced this issue Aug 7, 2019
…10 and added the no-cache parameter to the reply. (#11556)

* Changed the handleSessionExpired logic to return a 404 instead of a 410. Also added the no-cache parameter to the reply.
See #4417 for discussion.
@ZheSun88 ZheSun88 modified the milestones: 8.9.0, 8.8.6 Aug 7, 2019
ZheSun88 pushed a commit that referenced this issue Aug 8, 2019
…10 and added the no-cache parameter to the reply. (#11556)

* Changed the handleSessionExpired logic to return a 404 instead of a 410. Also added the no-cache parameter to the reply.
See #4417 for discussion.
@ffdybuster
Copy link
Contributor

This actually caused random session expired messages in our Vaadin 7 apps with Safari (macOS). One way to reproduce: start a Vaadin 7 app, wait until the session expires, then reload the page, log in, and wait for the next heartbeat. It will be the cached 410, resulting in a session expiry shown in the client, while the backend still has the session.

(Also, as commented in #11556, I think the current fix for this isn't perfect since it removes the session expiry message when it would correctly appear as well.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment