It thus returns html response back but does not clear session.
Could you please elaborate? Why do you think it doesn't?
Please generate HAR file containing full flow you have issues with. Here is some clues how to do it: link (Please use Firefox for this, Chrome generates incomplete HARs). Don't forget to set "Persist logs" checkbox, otherwise only the last page's trafic will be captured.