WordPress Login Issues — reauth=1
Recently, I was tasked to deploy a WordPress culster to AWS using ECS and Fargate.
Not going to bother you with all the details, but I did came across an issue after it was all set-up and ready to go.
The issue was that we were not able to sign in to the admin section of the app.
After a login attempt, we were being redirected back to the login screen with a ‘reauth=1’ flag in the query string
There are lots of blog posts out there suggesting how to deal with this issue:
- Clearing Your Browser Cache
- Manually Deactivating Plugins
- Reverting Back To Default WordPress Theme
- Renaming Or Deleting htaccess File
- Editing wp-config.php File with values related to cookie domain, home URL etc.
Non of these solutions worked for us.
What did end up doing the trick, was to add the following lines to the wp-config.php file:
You can generate these values by hitting the following URL:
Since we are launching ECS tasks using Fargate and we take advantage of the pre-packaged WordPress image from docker.io, we can’t really change the wp-config.php file.
These values had to be injected using the task definition’s environment variables.
So if you are using CloudFormation, you can use the following snippet:
I hope this helps someone.