Category: symfony

Can not set cookie in symfony app. How to fix it?

It can’t set cookie on my PC. I am working with my brother and it works for him on his PC if (isset($_POST[“stay_logged”])) { setcookie(“user_code”, $user->getCode(), null, “/”); $this->session->set(“user_code”, $user->getCode()); } isset($_POST[“stay_logged”]) return true, “stay_logged” is name of checkbox. sign_in.html.twig…

Why is my Symfony 5 local server showing the HTTP request as text instead of a rendered page?

I just wanted to try out Symfony 5 for my own education, so I followed the instructions here. symfony check:requirements shows that I have the requirements needed to run the application (I’m running Windows 10 with php 7.3.4 running via…

Service worker not registered when using docker and nginx

I’m facing the problem, that my service worker isnt registered when I use my docker setup. However, if I run my project locally everything works fine. if (‘serviceWorker’ in navigator) { navigator.serviceWorker.register(‘/sw.js’) .then((reg) => console.log(‘Worker registered!’, reg)) .catch((error) => console.log(‘Worker…

How to show custom 500 error page in production only in symfony?

I created a custom 500 error page by overriding the default 500 page. I did this by creating exception.html.twig template in templates/bundles/TwigBundle/Exception/exception.html.twig. But the problem is that it shows this template in all environments when a 500 error occurs. How…