AWS S3 Downloads redirect to login page

I recently moved my site now running php 7.1.28. All seemed to be fine but now I notice when a user clicks on my downloads inside their members area, instead of downloading from the AWS S3 bucket configured, the system redirects them to the members login page. Any thoughts on what to check to solves this issue? An example of the file link formats that I’ve used for over 4 years now that have always work is this…

https://homemusicstudio1.com/?s2member_file_download=filename

Hi David.

Hmm… What is the URL in the address bar after the redirection?

The s2Member download protection, if you were being redirection due to lack of access, would send you to the Membership Options Page, not the WP login one.

Do you get the same redirection if you try that URL logged in as when you’re not?

Wait, are you being redirected while logged in as an admin? If so, this is not s2Member’s doing. s2 never applies the restrictions to an admin.

I look forward to your update. :slight_smile:

Thanks for the reply. You are also correct in that this is actually the members options page that it is redirecting to, not the login page. Sorry for confusing that in my question. So here is an example of whats in the url after clicking a link.
https://www.homemusicstudio1.com/members-only/?_s2member_vars=file..level..1..file..RecoridngTracksThatMixWellIntroducti.mp3..Lz9zMm1lbWJlcl9maWxlX2Rvd25sb2FkPVJlY29yaWRuZ1RyYWNrc1RoYXRNaXhXZWxsSW50cm9kdWN0aS5tcDM%3D&_s2member_sig=1556018753-461118b8fd1fc21bc9d98a7d4324edcc

Also, since I’m using conditional tags to surround my link, the admin user cannot see them for some reason. I’ve always had to have a dummy account for testing. As far as seeing the url when not logged in, these pages site behind my members area the the link is not visible at all unless the user is logged in.

Here a link example for the results above.
https://homemusicstudio1.com/?s2member_file_download=RecoridngTracksThatMixWellIntroducti.mp3

Again this setup has worked flawlessly for many years now as this is a live production site with well over 2800 members. It just started happening when I moved my site over to another self managed vps running php 7 and WHM. When I look at my AWS account the credential also sho no access since I’ve moved over to the new hosting.

Do I just need to save all the files in my bucket and redue the configuration? There are 6 gigs of data to move but not sure where to go next. Really appreciate any insight.

I’v also just noticed from the link above, it says …level…1…file
All of these files should only be access by level 3 and higher, I’m using short code conditions for this. One example is below.
[s2If current_user_is(s2member_level3)][_s2If php="S2MEMBER_CURRENT_USER_PAID_REGISTRATION_DAYS >= 0"]

Still can’t find a fix for this one. My customers can’t download the files they are paying access for. Not sure of a fast fix but I also noticed this error in the server scanner. Error[ERROR] MySQL Database Extension
Missing MySQL extension. s2Member needs the MySQL extension for PHP. This will add MySQL support to your installation of PHP, allowing MySQL database communication. Please consult with your web hosting company about this message.

Could this be related? From my research the MySQL extension is no longer in use for PHP 7. Is this correct? Any other thoughts to check?
Thanks in advance.
Dave

Just discovered another strange thing. I’m using Really Simple SSL plugin to force everything secure. When I disable, then everything behind the members area gets redirected to the members options page. If I keep it on, only my s2/cloudfront integration files get redirected to the same members options page. I’m at a loss at the moment.
Best,
Dave

Just disabled all the S3 and cloudflare integration and put a file in my s2member-files directory. I get the same issue. Redirects to members option page. I am running my own vps on Centos and WHM. Could this be related to how I have my web server setup?

For anyone else who may come accross this issue. I discovered that my main site url is www.sitename.com but the links to the member files were sitename.com. Adding the www before the url fixed my issue. Problem solved.

2 Likes

Thank you for the update! I’m glad you figured it out. :slight_smile:

See also: https://www.primothemes.com/forums/viewtopic.php%3Ff=36&t=1066.html