Support the ongoing development of →
Requests Input Testing
Last updated 2 years ago.

websterl3o liked this thread


It seems that the problem is cookie encryption. Laravel will delete the cookies that it can't decrypt. As test cookies is not created by laravel (I simply use an array to test cookies as seen in the previous post), they are not encrypted and they will be deleted. I can think of two solutions for this problem.

  1. Simply remove cookie middleware from the list in app/Http/Kernel.php. All cookies will be sent to and received from the client as they are. If you don't need encryption or you want to read some cookies in the client side this is a nice solution.

  2. Edit middleware so that it won't encrypt or decrypt cookies during testing. Just add a code to handle function that checks the environment and continues without doing anything if environment is testing. This middleware is in Illuminate/Cookie/Middleware/EncryptCookie.php. So a framework update will undo your editing in this file. If you need encrpytion this is your only solution.

Last updated 9 years ago.

Sign in to participate in this thread!


Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.