I am trying to set my website ready before installing and configuring Varnish on it.
For that, in lots of cases where I have php functions in .module files that include some tests about cookies if ($_COOKIE['travelID'] == 'yo'){..}
, I was afraid that the page will be cached and the condition will be executed only once and then all the users will get the same result.
To avoid this issue related to varnish and caching,
In most cases I moved the code to javascript and put all the cookies logic there.
In other cases where I couldn't reproduce the entire same logic in javascript, I simply wrote an ajax call in JS where I specified the path of a controller function that have the exact same behavior. And I kept the same php cookie condition in the controller file but I specified that this url must no be cached in the Varnish configuration.
However I have one submitForm() funtion in a custom module associated with one of my custom forms. this submitForm function starts with this same cookie condition mentioned above. I was thinking that maybe submitForm functions aren't cached by default on Varnish ? Can someone confirm this ? or if this is not the case, what can I do to set this cookie condition in js or something?