<p>All right, after a good night of sleep starter to put trace all over the place to see what's going on... So I share, just so if it can help anyone...
I found out the variable was there on the header and the footer block, but not in the main content... Turns out, another developer put this code in the twig page...</p>
<pre><code>{% cache if not craft.app.config.general.devMode %}
   {% block content %}
   {% endblock %}
{% endcache %}
</code></pre>
<p>I think the front-end dev put this for page speed purposes, but it created a big mess for the back-end developer I am!</p>
<p>So anyway, hope it will save someone else a lot of time !</p>

CC BY-SA 4.0
2022-07-14T13:43:19.803Z
2022-07-14T13:43:19.803Z
Sylvain Tremblay
<p>Craft 4. On environment=dev, it works just fine, but as soon as I set it to staging or Prod, any parameter passed either in url (get) or on the form (POST) can't be retrieve. The url shows the parameters, and if I switch to form method=post, I can see on the console the post data are sent.
However, on my twig page, craft.app.resquest.getParam(&quot;myvar&quot;) is not found, neither by getPost or even isPost, or anything !
It's not a matter of server since I can reproduce the error locally, by switching env var.
Also, it may be some sort of cache problem, since if I clear cache, it behaves somehow better...
Any idea to point me in the right way ?</p>
<p>Sylvain</p>

<request><params>
request (Get and Post) problems
# request (Get and Post) problems

(Asked by: username_0 on 2022-07-13)

Craft 4. On environment=dev, it works just fine, but as soon as I set it to staging or Prod, any parameter passed either in url (get) or on the form (POST) can't be retrieve. The url shows the parameters, and if I switch to form method=post, I can see on the console the post data are sent.
However, on my twig page, craft.app.resquest.getParam("myvar") is not found, neither by getPost or even isPost, or anything !
It's not a matter of server since I can reproduce the error locally, by switching env var.
Also, it may be some sort of cache problem, since if I clear cache, it behaves somehow better...
Any idea to point me in the right way ?

Sylvain

**Tags:** request, params


---

## 1 answers

### Answer by username_0 on 2022-07-14. Score: 1

All right, after a good night of sleep starter to put trace all over the place to see what's going on... So I share, just so if it can help anyone...
I found out the variable was there on the header and the footer block, but not in the main content... Turns out, another developer put this code in the twig page...
{% cache if not craft.app.config.general.devMode %}
   {% block content %}
   {% endblock %}
{% endcache %}

I think the front-end dev put this for page speed purposes, but it created a big mess for the back-end developer I am!
So anyway, hope it will save someone else a lot of time !


---

