Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.6k views
in Technique[技术] by (71.8m points)

Symfony5 The CSRF token is invalid - after upload on hosting

I have strange problem: i have dev version on pc on localhost and it;s work but after uploading on hosting on every form i have error:

The CSRF token is invalid. Please try to resubmit the form. 

I tryied repload, delete cache and everytime the same error on all forms. I have another application uploaded on the same hosting 2 months ago and everything works fine:

One of my forms:

{% block body %}
    <h1>Formularz Kontaktowy</h1>
    {% form_theme contactForm 'bootstrap_4_layout.html.twig' %}
    {{ form_start(contactForm) }}
    {{ form_row(contactForm.name) }}
    {{ form_row(contactForm.email) }}
    {{ form_row(contactForm.subject) }}
    {{ form_row(contactForm.body) }}
    {{ form_row(contactForm.submit) }}
    {{ form_end(contactForm) }}
{% endblock %}


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Problem solved ! i need to type my page adress by https not http !


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...