# Access by POST method refused by CSRF protection in main.inc.php

**URL:** <https://www.dolibarr.org/forum/t/access-by-post-method-refused-by-csrf-protection-in-main-inc-php/18466>\
**Category:** Maintaining my Dolibarr\
**Tags:** v10, Security, v11, Setup-Configuration\
**Created:** [February 1, 2020, 8:25am UTC](https://www.dolibarr.org/forum/t/access-by-post-method-refused-by-csrf-protection-in-main-inc-php/18466 "2020-02-01T08:25:43Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![nikolay86](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/nikolay86/32/133_2.png) [@nikolay86](https://www.dolibarr.org/forum/u/nikolay86)\
**Post date:** [February 1, 2020, 8:25am UTC](https://www.dolibarr.org/forum/t/access-by-post-method-refused-by-csrf-protection-in-main-inc-php/18466/1 "2020-02-01T08:25:43Z")

</div>

Hi all,  
we have just updated the script from 10.0.6 to 11.0 and there is one bug that we have noticed. When we are trying to see what are the margins for a specific period of time, the following error occur on a white page:  
**Access by POST method refused by CSRF protection in main.inc.php. Token not provided. If you access your server behind a proxy using url rewriting, you might check that all HTTP header is propagated (or add the line $dolibarr\_nocsrfcheck=1 into your conf.php file or MAIN\_SECURITY\_CSRF\_WITH\_TOKEN to 0 into setup).**  
Any ideas how this one can be fixed?

Thanks!

---

<div class="post-metadata">

**Author:** ![ChoY](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/c/d9b06d/32.png) [@ChoY](https://www.dolibarr.org/forum/u/ChoY)\
**Post date:** [February 2, 2020, 1:59pm UTC](https://www.dolibarr.org/forum/t/access-by-post-method-refused-by-csrf-protection-in-main-inc-php/18466/2 "2020-02-02T13:59:46Z")

</div>

I had the same problem. It seems to me that there it is a bug in Dolibarr 11 about csrf check. For now it can be resolved just as described in the message  
Set the variable from $dolibarr\_nocsrfcheck=0 to $dolibarr\_nocsrfcheck=1  
at htdocs/conf/conf.php\*\*

---

<div class="post-metadata">

**Author:** ![nikolay86](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/nikolay86/32/133_2.png) [@nikolay86](https://www.dolibarr.org/forum/u/nikolay86)\
**Post date:** [February 8, 2020, 6:15am UTC](https://www.dolibarr.org/forum/t/access-by-post-method-refused-by-csrf-protection-in-main-inc-php/18466/3 "2020-02-08T06:15:12Z")

</div>

Thanks! I have change it in the Dolibarr in the field MAIN\_FEATURES\_LEVEL - a ZERO needs to be placed in order to clear that issue.

BR!

---

<div class="post-metadata">

**Author:** ![andrevivar](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/andrevivar/32/245_2.png) [@andrevivar](https://www.dolibarr.org/forum/u/andrevivar)\
**Post date:** [February 10, 2020, 10:20pm UTC](https://www.dolibarr.org/forum/t/access-by-post-method-refused-by-csrf-protection-in-main-inc-php/18466/4 "2020-02-10T22:20:14Z")

</div>

FIXED THANKS A LOT it was very helpeful

---

<div class="post-metadata">

**Author:** ![ksar](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/ksar/32/514_2.png) [@ksar](https://www.dolibarr.org/forum/u/ksar)\
**Post date:** [February 18, 2020, 9:01am UTC](https://www.dolibarr.org/forum/t/access-by-post-method-refused-by-csrf-protection-in-main-inc-php/18466/5 "2020-02-18T09:01:01Z")

</div>

Hello,

Are you using MAIN\_SECURITY\_CSRF\_WITH\_TOKEN=1 ?  
The feature to protect by token is still in development and is not yet finished.

---

<div class="post-metadata">

**Author:** ![Michele](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/m/ed8c4c/32.png) [@Michele](https://www.dolibarr.org/forum/u/Michele)\
**Post date:** [March 25, 2020, 1:28pm UTC](https://www.dolibarr.org/forum/t/access-by-post-method-refused-by-csrf-protection-in-main-inc-php/18466/7 "2020-03-25T13:28:32Z")

</div>

Problem here is not on delay but on the fact that you open other page and the feature to protect by token is still in development and is not yet finished. When development will be finished, this will not happen [dgcustomerfirst](https://www.dgcustomerfirst.net/)

---

<div class="post-metadata">

**Author:** ![Denis1](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/d/7ba0ec/32.png) [@Denis1](https://www.dolibarr.org/forum/u/Denis1)\
**Post date:** [September 28, 2020, 9:42am UTC](https://www.dolibarr.org/forum/t/access-by-post-method-refused-by-csrf-protection-in-main-inc-php/18466/8 "2020-09-28T09:42:28Z")

</div>

hello, tanks ChoY the solution works for me  
bye

---

<div class="post-metadata">

**Author:** ![sadek](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/s/e68b1a/32.png) [@sadek](https://www.dolibarr.org/forum/u/sadek)\
**Post date:** [April 6, 2022, 7:16am UTC](https://www.dolibarr.org/forum/t/access-by-post-method-refused-by-csrf-protection-in-main-inc-php/18466/11 "2022-04-06T07:16:04Z")

</div>

Solved with V 15.0.1  
Many thanks
