Problem with PHP snippet - it stops working moments after clearing the cache

Summary

We have created a PHP script that automatically redirects the user to the appropriate language version of the website, it does it in the language of the browser. The script works properly after clearing the cache, but after 1-2 minutes the script stops working. It seems to me that this is some kind of cache error because after clearing it, the script works fine again for 1-2 minutes.

Step to reproduce

The code is added correctly in the snippet.

Observed behavior

The script works only for a while after clearing the cache after about 1-2 minutes it stops working.

Expected behavior

Script running continuously.

Environment

MODX Revolution 2.6.5-pl

Do you run this snippet uncached? (With a ! in the snippet tag β†’ [[!yourSnippet]]?)
If the result of the snippet is different for different user requests, then it has to be uncached.

Also, it may be easier to give useful advice, if you could post the actual snippet code.

1 Like

Thanks for your help, now the script works fine.

This topic was automatically closed 2 days after discussion ended and a solution was marked. New replies are no longer allowed. You can open a new topic by clicking the link icon below the original post or solution and selecting β€œ+ New Topic”.