AWS This

WordPress Login Issues — reauth=1

The Joy of Modern-Day Devops

Recently, I was tasked to deploy a WordPress culster to AWS using ECS and Fargate.

Photo by Launchpresso on Unsplash

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:

  1. Clearing Your Browser Cache
  2. Manually Deactivating Plugins
  3. Reverting Back To Default WordPress Theme
  4. Renaming Or Deleting htaccess File
  5. 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:

define('AUTH_KEY',         '');
define('SECURE_AUTH_KEY', '');
define('LOGGED_IN_KEY', '');
define('NONCE_KEY', '');
define('AUTH_SALT', '');
define('SECURE_AUTH_SALT', '');
define('LOGGED_IN_SALT', '');
define('NONCE_SALT', '');

You can generate these values by hitting the following URL:
https://api.wordpress.org/secret-key/1.1/salt/

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.

Problem solver, creative thinker, terrible tagline writer.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store