Regarding the __test cookie

website: https://senex.ct.ws

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?

The _test cookie is part of the Security System:

We are unable to change anything with the Security System.

6 Likes

So, can’t I host a SPA?
I am not making any automated scripts or something else.

Do you mean Single Page Application?

It’s possible to do this, but not in the way you have it set up. You may have to wait for somebody else to come online and help.

2 Likes

ok :slightly_smiling_face:

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.

6 Likes

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. :slightly_smiling_face:

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.

6 Likes

nothing is fixing my issue.
thank you for your help.

What all have you tried?

4 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.