Setting $cookieSecure = true; - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Setting $cookieSecure = true; (/showthread.php?tid=72857) |
Setting $cookieSecure = true; - donpwinston - 02-20-2019 When I set $cookieSecure = true; in Config/App.php and submit a form I get the following error: BASEPATH/Security/Security.php at line 193 PHP Code: 186 } My form uses the csrf function to create a token. Why is that a problem? RE: Setting $cookieSecure = true; - puschie - 02-22-2019 so you got thrown a LogicException ? can you provide the part of code that creates your form ( or open the form ) RE: Setting $cookieSecure = true; - donpwinston - 02-22-2019 (02-22-2019, 03:14 AM)puschie Wrote: so you got thrown a LogicException ? This is the view that creates the form. If I set set $cookieSecure = false; it works fine. PHP Code: <main class="usa-grid usa-section usa-content usa-layout-docs" id="main-content"> RE: Setting $cookieSecure = true; - puschie - 02-25-2019 your form looks valid to me another reason could be the access type -> secure cookie only works in https requests so for http you need to disable secure cookie ( or disable http access with $forceGlobalSecureRequests ) this is handled in CodeIgniter\Security\Security:241 ( CSRFSetCookie ) RE: Setting $cookieSecure = true; - donpwinston - 02-25-2019 "another reason could be the access type -> secure cookie only works in https requests" I'm using http in development so that could be why. Also looks like the code has changed with the more recent releases. Thanks. |