Category : cookies

i’m looking for the way to handle cookies in Symfony 5 … and there is nothing really usefull online. To set a news cookie, i do : use SymfonyComponentHttpFoundationCookie; //….. $cookie = new Cookie(’email’, $data[’email’] ,time() + (365 * 24 * 60 * 60)); $response->headers->setCookie($cookie); $response->sendHeaders(); And it works (don’t hesitate to tell me if ..

Read more

first time using docker and nginx reverse proxy. Setup Dockerized front with Vuejs behind localhost:4200 Dockerized back with Symfony behind a dockerized nginx on localhost:80 Trouble Every time I add a cookie to the response, the Set-Cookie get ignored by the front. Telling me: This Set-Cookie was blocked because its Domain attribute was invalid with ..

Read more

I made two tests with exactly the same code except the returned status code of my request (200 for one test, and 201 for another test). Here the only difference between my two tests: return new JsonResponse(["id" => $transaction->getId()], Response::HTTP_OK); and return new JsonResponse(["id" => $transaction->getId()], Response::HTTP_CREATED); In the first case, no Set-Cookie header is ..

Read more

I have 4 framework files: /config/framework.yaml: framework: csrf_protection: true session: # enables the support of sessions in the app enabled: true # ID of the service used for session storage. # NULL means that Symfony uses PHP default session mechanism handler_id: Symfo/blnyComponentHttpFoundationSessionStorageHandlerRedisSessionHandler # improves the security of the cookies used for sessions cookie_secure: true cookie_lifetime: ..

Read more