page does not refresh after login
-
I am using a Nextend social login within a popup (popup maker)
it works well and the user can login (or register). However,
the page from which the popup was activated is not reloaded.
it doesn’t seem like a cache issue (as I disabled all cache).
it doesn’t seem related to a redirect (I tried to configure the social login both with and without redirect).
it seems to me related to the popup because when I put the social login on the page itself it refreshes after the login.Anyone has a solution for that? maybe it should work with another popup maker?
The page I need help with: [log in to see the link]
-
Hi @shaharm
The problem seems to be that the following cache-control header is set on your home page:
cache-control: max-age=7200
this means that the content of the home page won’t change utnil 7200 seconds (or until the cache is cleared).There are two test cases to see if that’s indeed causing the problem:
- if you hard refresh the page after the login by pressing Ctrl+F5 on Windows or Cmd+Shift+R on Mac
- or if you open the Network tab of the browser and you Disable the cache – like you see here: https://www.technipages.com/google-chrome-how-to-completely-disable-cache
In both cases the “This text can only be seen by logged in users ” appears correctly on the home page.
The cache control header can be set by a caching plugin or by the host. If you have any caching plugin try turning it off to see if that makes any difference. If not (or you don’t have any kind of caching plugin) I recommend contacting your host about this.
Hi,
Thanks a lot! You are right. it’s related to the cache, I used the “disable cache” from the browser and then it worked.
I disabled any add-on.
I am using Bluehost so made sure caching is disabled both from the WP add-on but also from their management interface but the problem persists.Got any hint where else could the caching be coming from? and also how come the phenomenon of no update to the user could not be noticed when the social login is not in a popup but on the page itself? if it’s just a caching issue I would expect the same problem in both cases.
Hi @shaharm
In this case it will be probably set by your server or maybe Cloudflare ( as I see it is enabled on your site ).
First of all I would suggest getting in touch with your host, and ask them about the cache-control header, if it is set by them or not.
If it is, then you should tell them about this caching problem for the logged in users, they will be able to help you in fixing it.As for the question about the behavior when the button is in the popup or not in the popup:
Actually this doesn’t really matter. All that matters is whether the browser cached the page earlier or not.
For example:
A) If you open incognito mode, and you go directly to the /wp-login.php page of your site and you press the social button there, then when you are redirected to your homepage you will be logged in fine.
B) However if you open incognito mode, visit the homepage first, then you go to your /wp-login.php and try to login with the social buttons, then you will see the problem occur when you are redirected to your homepage. This is because your browser will already have a stored version of your homepage this time with a state where the user was not logged in yet. And because of the cache-control header, your browser will display that cached version.as for Bluehost, i approached them now, currently they seem quite clueless. it take me 30 minutes to just explain what is the issue….
I am quite sure that Cloudflare not doing any caching now but cannot be sure. i could not completely take it off.
as for your explanation, that is exactly the point, your B scenario does not work as you described. it shows me the updated homepage with the logged in state. you are welcome to check.
that gives me the indication it might be a combination of cache, the popup and the social login but I am not sure it is just cache.Hi @shaharm
I have just checked it in Google Chrome 94.0.4606.81 on Windows 10 and it worked exactly as I described in point B, but it all depends on the browser how it handles the browser cache.
Anyways the problem is caused by the cache-control header as we described earlier. So this problem can only be solved on the end, where the “cache-control” response header is set, I am sorry.
If your host is not really sure about what you mean by “cache-control” header, then please:
- send them the link of your homepage.
- ask them to open the Network tab of the browser e.g. in Google Chrome: https://developer.chrome.com/docs/devtools/network/#load
- then they should filter for “Doc” ( Documents )
- refresh the page
- finally they should click on the name of the document in the list and there they should check the Response Headers. They will find this “cache-control: max-age=7200” header there. And you should ask if that header is set by them or not.
Just in case I also took a screenshot, see here:
Best regards,
Laszlo.thanks a lot for the detailed help. i am on it, trying to resolve it with Bluehost people.
Hi! I’m having the same issue, in that the cached version of the page is being presented after the redirect. I use cloudflare. How do I make sure an uncached version of the page is loaded? Can I add a “?123” or something to the redirect uri?
Also, I don’t want to just disable caching on my whole site…that doesn’t make any sense.
Hi @beezwings
Please note that this topic was already marked as resolved, so we might miss your messages. If you have a question or problem, then please rather open a new topic or get in touch with us over the ticket system:
If you have a similar problem then you can paste the link of the topic to your message.
Anyways on the linked page I can see the same problem with the cache-control header, and that makes the browser still display the earlier cached HTML of a result where the user was not logged in yet.
Like I mentioned above the cache-control specific problems can only be solved on the end where the cache control header was set. I think it is set by your host as well, but you could confirm that by temporarily disabling Cloudflare and then check if the problem still occurs or not.A possible workaround:
First of all when you use Cloudflare it is usually recommended to set its Caching level to “No Query String”: https://developers.cloudflare.com/cache/how-to/set-caching-levels – that way Cloudflare will only serve the results from cache if there is no query string in the URL. You probably already used that setting, I just wanted to inform you to keep using that.Secondly, in your case redirecting to an URL with a query string seem to solve the problem, so your cache is configured the way that GET parameters can bypass it.
You could redirect to an URL with a GET parameter in 2 ways:
A.) By adding an URL with a query string into the “Fixed redirect url – for Login/Register” fields. E.g.: https://dorotheerosen.ca/my-account/?no_cache=1
However please note that, it will always redirect to the specified URL!
B.) You could add a GET parameter to the redirect url over our {{provider-id}}_login_redirect_url and {{provider-id}}_register_redirect_url filters. In our developer documentation you can learn more about these filters: https://nextendweb.com/nextend-social-login-docs/backend-developer/Tip: At the bottom of the developer documentation you can find an example for getting the URL of the page where the social button was pressed: https://nextendweb.com/nextend-social-login-docs/backend-developer/#exclude-from-fixed-redirect-url
- The topic ‘page does not refresh after login’ is closed to new replies.