I have hosted a SPA at the above url developed with Vue.js + PHP.
Since SPA are caching files in the first time of loading, it looks like the web site is accessing the cached files during next loads.
However, during the first time of loading it automatically creates a cookie named __test with a life of about 6 hours. It is not a problem for me whether it is or not, but during next loads, the cookie is not refreshing. So, after the cookie expires, usually about 6 hours from the first load, all the json requests called through my web site get failed.
Though I refreshed the browser window manually, the cookie is not refreshing.
So, I have to clear all the cache manually and refresh the window to create a new __test cookie.
Can you please give me a solution or simply extend the lifespan of that cookie to fix my problem?
Hosting an SPA absolutely works. However, as you’ve experienced, there are limits to how long you can keep it open without running into issues with the test cookie system.
For most websites, this is not an issue, because most people spend only a few minutes on any website they visit. Only when you keep the page open for many hours are you likely to run into this.
Simply extending the duration of the cookie will not work, the parameters of the cookie are rotated every few hours, which invalidates previous cookies. This will cause any further AJAX requests to fail, until you refresh the entire page to generate a new cookie.
If this is a problem for how people use your site, the best recommendation I can give is to have your code check for the server not responding anymore to requests, and when so, reload the entire page to get a fresh cookie.
sometimes, though I refresh the page also, cookie is not refreshing.
I have to completely clear all the cache from settings and then refresh the page.
However, if it is a security restriction or something else from your side,
yes, I can understand and I have to be under the limitations of Free Hosting.
So, I thinked adjusting the life span of cookie will fix the problem. That is why I seeked your help.
However, if it is not, feels like you also cannot do anything for me and I have to adopt for the things I got with valuable free hosting.
So, I feels like I can’t host my site anymore with this __test cookie.
I have to change my site or else change the hosting solution.
Anyway, thank you for spending your valuable time to address my issue.
Is the page being loaded static HTML? If so, then refreshing the page is probably not actually giving you a new page, because our servers are configured to setup quite strict browser cache for all static files, including HTML files.
I think you can bypass it with .htaccess rules, but a very simple fix could be to rename the files from .html to .php. PHP code is dynamic, so the output of any PHP scripts is not cached, and refreshing the page will give you a new cookie.