Welcome Guest, Not a member yet? Register   Sign In
Best way to automatically force https
#1

Hi! What would be the best way to automatically force https redirection with CI4?
Reply
#2

In app/Config/App.php there's a flag for that.

PHP Code:
/**
     * --------------------------------------------------------------------------
     * URI PROTOCOL
     * --------------------------------------------------------------------------
     *
     * If true, this will force every request made to this application to be
     * made via a secure connection (HTTPS). If the incoming request is not
     * secure, the user will be redirected to a secure version of the page
     * and the HTTP Strict Transport Security header will be set.
     *
     * @var bool
     */
    
public $forceGlobalSecureRequests false

You could also set it in your Apache/Nginx/etc configuration, so whichever works best for you.
Reply
#3

Oh gosh! Didn't spot it in the docs. Thanks a lot!
Reply




Theme © iAndrew 2016 - Forum software by © MyBB