I've some testing on my development site. I can confirm that I get the issue with the following steps:
- Without logging in
- click on the download button for an inaccessible file which is displayed
- this will display the log in screen and a notice that you need to be logged in
- log in - which will return you to the download
- click on the download, which will take you back to the log in screen and displays a log out button
with some additional testing I can confirm that the issue is related to expire headers in our .htaccess file. (removing the expire headers in the .htaccess fixes the issue)
The following lines in the .htaccess file were the cause
########## Begin - Optimal default expiration time
<IfModule mod_expires.c>
# Enable expiration control
ExpiresActive On
# Default expiration: 1 hour after request
ExpiresDefault "now plus 1 hour"
(The code below is excluded from this post since the maximum number of allowed characters in a post is 3000)
# CSS and JS expiration: 1 week after request
# Image files expiration: 1 month after request
# Audio files expiration: 1 month after request
# Movie files expiration: 1 month after request
# Add correct content-type for fonts
# Add a far future Expires header for fonts
</IfModule>
########## End - Optimal expiration time
I assume there is some file which is being cached by the browser thanks to the expire headers which is causing the problem.
From my testing it seems the "Default expiration: 1 hour after request" line is the root cause. Seems some file needs to be excluded from the expire header in the .htaccess file.