CodeIgniter Forums
How to prevent from starting session for specific route? - 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: How to prevent from starting session for specific route? (/showthread.php?tid=74667)



How to prevent from starting session for specific route? - kingstyles - 10-22-2019

As you know for API Rout session should not start... then how to disable session for specific Route?


RE: How to prevent from starting session for specific route? - kilishan - 10-22-2019

Well - the session is never started unless you specifically start it. That means you're in full control here. You could only start it when you actually need to grab something. You could have two different base controllers, one for API, one for the rest, and start it in the non-API controller. You could have a check in your base controller against the URI, etc.