Password Reset Links Aren't Working

Summary

Some web hosts aggressively cache sites for performance reasons, and while this is a good thing, it can sometimes cause problems with things like password reset links. This can also happen with caching plugins like WP Super Cache and W3 Total Cache. This can be easily resolved by excluding your login page from the caching system.

Web Host Caching

To have your host disable caching on your login page, open a support ticket with them and ask them to exclude it. The login page location is controlled by the setting under Restrict > Settings > Misc. Feel free to use the example below and adjust the URL for your site:

Hi,

My site runs the Restrict Content Pro plugin and I'm having problems with password reset links not working. The Restrict Content Pro support team has asked me to add a cache exception for our login page. Could you please add the following URL to the exception list?

http://YOURSITE.com/{put your login page URL here}
	

Thanks!

Reminder: "YOURSITE.com" should be replaced with your actual domain name.

Varnish Caching

If your server uses Varnish caching then your Varnish config might look something like this to disable caching on the login page:

# Do not cache the admin and login pages
if (req.url ~ "/wp-(login|admin)" || req.url ~ "/login")
    return (pass);
}

You will also need to ensure Restrict Content Pro is able to set the password reset cookie. Your config might already look something like this:

if (beresp.http.Set-Cookie && bereq.url !~ "^/wp-(login|admin)" && beresp.http.Set-Cookie !~ "comment_") {
	unset beresp.http.Set-Cookie;
}

You'll need to also add in a check for cookies prefixed with "rcp-" like this:

if (beresp.http.Set-Cookie && bereq.url !~ "^/wp-(login|admin)" && beresp.http.Set-Cookie !~ "comment_" && $.http.Set-Cookie !~ "rcp-") {
	unset beresp.http.Set-Cookie;
}

Caching Plugins

Each caching plugin is different. You can find the cache exclusion option in the plugin's settings. If you have any questions, please contact the support team for the caching plugin.

Most caching plugins allow you to exclude specific pages from caching. To resolve the issue, add the page that contains the [login_form] shortcode to the exclusion list.

Plugins that are known to cause issues if the exclusion is not set:

  • WordFence
  • W3 Total Cache
  • WP Rocket
  • WP Super Cache