• Resolved raywjohnson

    (@raywjohnson)


    Greetings,

    Most excellent plugin. Simple, direct, and works. Nice.

    So this issue is not the plugin. It is the stupid browser caching the 302 redirects.

    Here is what happens. I use the hidden link, login, all good.

    An hour later, I use the hidden link, redirects to /wp-admin/ (as it should, as I am already logged in).

    But, the browser then cached that redirect. So the next time (not logged in), when I use the hidden link, the BROWSER redirects to /wp-admin/ and I get a 404 page. Only clearing the browser cache fixes this.

    So, could you add the WP “nocache_headers()” function before doing any redirections?

    –RayJ

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support Lea WPServeur

    (@leacomm)

    Hi,
    The nocache_headers() function is already present in the wp-login.php file, as it is native to WordPress.
    The redirections themselves are not cached server-side.
    This appears to be an issue with local browser caching, because as you described, the problem disappears when using private browsing or after clearing your cache.

    Thread Starter raywjohnson

    (@raywjohnson)

    Keep up the good work! I am not certain at all. I was attempting to figure out, and pinpoint, where the issue was in the code. I fully suspect another plugin might be part of the issue. I have this happen on several sites. But it seems very random. I could not reproduce the issue intentionally. I tried for an hour or so the get the browser to cache the redirect. It would not. System worked as expected. Intermittent issues are the worst.

    Plugin Support Lea WPServeur

    (@leacomm)

    Hi @raywjohnson Thanks for your screenshot.
    When you click on the redirected URL, do you see in the headers whether the cache is active?


    Do you use a caching plugin like WP Rocket, W3 Total Cache, or something similar?
    If so, make sure to exclude all login related pages from caching, such as:
    /your-login-url, /wp-admin, and /wp-login.php.

    Thread Starter raywjohnson

    (@raywjohnson)

    Yep. The browser is caching the 302. If I disable cache in the tools, that fixes it while disabled.

    I never use caching plugins. They cause more issues than they solve.

    Thread Starter raywjohnson

    (@raywjohnson)

    I cannot change plugins. I tested a few, non compare. The other plugins I tested all seems to have some odd issue. When I tested WPS Hide Login, it just did what is said it would do.

    I may have narrowed this issue down a bit, and it might not be WPS Hide Login as the primary cause. It might be WP itself. I am still testing.

    This link format seems to be the culprit:

    https://example.com/{HIDDEN-LOGIN}/?redirect_to=https%3A%2F%2Fexample.com%2Fwp-admin%2F&reauth=1

    Starting there, I checked the console, and /wp-admin/ was cached. Logged in, logged out, tried the plan domaind/{HIDDEN-LOGIN} and got the 404. It replicate this I used clean browser profile with all cookies and cache clear.

    Plugin Support Lea WPServeur

    (@leacomm)

    Hi,

    Have you tried re-saving your permalinks without changing any settings, just clicking “Save Changes” as they are?

    You can also try deactivating your plugins one by one… And check your browser history settings as well.

    Thread Starter raywjohnson

    (@raywjohnson)

    I have not done that yet. I will give it a go when I have time.

    Thread Starter raywjohnson

    (@raywjohnson)

    Greetings all,

    I wanted to follow up and make sure that I let everyone know that in all my testing. I could not find a fault in WPS Hide Login plugin. As in, it was always some other plugin or theme that ended up being the cause of the 404 errors.

    Embarrassingly, the main culprit was a child theme of my own design. Which is why I kept seeing the issue on more that a few sites I work on. I absolutely proved that it was my theme as the main cause.

    I realize it is a pain to disable each plugin, test, repeat. Then switch the theme and test. But here is the key to success.

    If the 404 is the 404 page set in the Hide Login settings for the plugin (default is /404/). That is either the Hide Login plugin, but can be cause by other plugins or the theme. If it is any other page /wp-admin/index(or options or plugins or posts).php?page=pagename, that is not the Hide Login plugin. Which is what I was seeing and not realizing it.

    I did not spot this fact until after many many (many) tests.

    –RayJ

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Request for adding nocache_headers function’ is closed to new replies.