-
Notifications
You must be signed in to change notification settings - Fork 72
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
Deleting session cookie with redirect can lead to infinite redirects #916
Comments
I think you would have to decide whether to send I can see a need for each behaviour and I'm not sure what the best way to toggle would be. |
I would argue that this can be done simply by overriding I think that having to override WAApplication>>expiredRegistryKey: aRequestContext
"override this method to react to expired keys in a different way"
aRequestContext request isXmlHttpRequest ifFalse: [ ^ self ].
self
forbidden;
respond and WAApplication>>handleExpired: aRequestContext
^ self
expiredRegistryKey;
handleDefault |
The idea behind |
Ok, I see. So how about this: we provide an empty implementation for
|
Yeah I'm leaning towards something like this. Maybe instead of an empty |
Ok. I'll revise my PR. |
I thinks there's still a problem here:
So in the end, the response will consist of the error message (plain text) plus the default output (probably html), which is clearly wrong. Here's a slightly different approach:
Developers can now mix and match. Your thoughts? |
I prefer sending |
But wouldn't that break existing applications? The redirect currently prevents clients from noticing the that the session has expired. When we force a response in the default case, the client will see an error message and be stuck / forced to manually reload the page. |
Yes, it's a behavioural change. But it's not like clients currently won't notice. Any state that's not in the URL is lost, including form based logins. Yes, if you're using URL query fields then manually reloading won't even fix the issue. |
This problem have been happening in my service. 😢 |
@takano32 what would be more appropriate for your application, rendering an "error page" or rendering the "start page"? |
@marschall Browser says 'ERR_TOO_MANY_REDIRECTS' and doesn't display any page. |
@takano32 Yes, that is the error this issue describes and which we will fix. The question is what the default behavious should be and we'd like your opinion. What do you want your users to see (or not) when the session has expired? Would you want to inform them that any form data etc. has been lost? Or would you be happy to simply refresh the page? |
@marschall I think we may be looking at different usage scenarios. In my scenario there is usually no data associated with a session that is worth keeping around. When a session has expired I don't want the user to notice. Example:
I want the user to not notice that the session has expired. He should simply be taken to the requested page. Of course there are situations where a page may be reloaded and data may be lost but I'm ok with that. What you have in mind, I think, is more along the lines of classic Seaside use, where every action is associated with a continuation. To be fair, that is probably the more common case for Seaside users, so we should probably stick to that and consider my scenario a special case. |
@theseion @marschall Sorry, I didn't understand your question.Now I see. In production visitor traverses many pages and almost always session expire is not so important. |
That's a good point. Session expiry with a shopping cart should be announced to the user regardless from the behaviour during simple navigation. |
@theseion I agree, default behaviour show the expiry page and make trying to cover from URL-state an opt-in |
Browsers are very nasty when confronted with a 'Set-Cookie' header in a 302 (temporarily moved) response. They may ignore the 'Set-Cookie' instruction completely or use very weird matching, which can lead to some cookies being deleted while others will simply stick around (see issue #915 for why there may be multiple session cookies at a given time). I know this because I've spent several days debugging such a problem :/. The symptom for users is often an infinite redirect loop (which browsers will cut short after a while).
The implementation of deleting the session cookie in Seaside will do exactly what I have described above, thus allowing for infinite redirect loops to occur. For Cmsbox we have a long standing fix, which looks like this for Seaside 3:
So we delete the session cookie but then create a new session and proceed. The browser will see a response with status 200 and one or multiple 'Set-Cookie' headers (e.g. one for removing the old cookie and one for setting the new one).
The text was updated successfully, but these errors were encountered: