verbb / patrol

Easy Maintenance Mode and Smart HTTPS Routing for Craft CMS
MIT License
29 stars 8 forks source link

Force SSL only works when ticked in CP. #22

Closed brandondeweese closed 2 years ago

brandondeweese commented 4 years ago

So I've configured the file config to force SSL on my sites. HTTPS works fine, but HTTP doesn't redirect even though 'sslRoutingEnabled' => true. It doesn't look like this is supposed to happen, right? Heres my config:

` return [ // Global settings '*' => [ 'primaryDomain' => null,

  'sslRoutingRestrictedUrls' => ['/'],

  // Default Week Start Day (0 = Sunday, 1 = Monday...)
  'defaultWeekStartDay' => 1,

  // Whether generated URLs should omit "index.php"
  'omitScriptNameInUrls' => true,

  // Control Panel trigger word
  'cpTrigger' => 'admin',

  // The secure key Craft will use for hashing and encrypting data
  'securityKey' => getenv('SECURITY_KEY'),

  // Whether to save the project config out to config/project.yaml
  // (see https://docs.craftcms.com/v3/project-config.html)
  'useProjectConfigFile' => false,

],

// Dev environment settings
'dev' => [
    'allowAdminChanges' => true,
    'devMode' => true,
    'siteUrl' => 'http://etesian.build',
    'sslRoutingEnabled' => false,
],

// Staging environment settings
'staging' => [
    'allowAdminChanges' => true,
    'devMode' => true,
    'siteUrl' => 'http://etesian.madebyiris.co',
    'sslRoutingEnabled' => false,
],

// Production environment settings
'production' => [

    'devMode' => false,
    'redirectStatusCode' => 301,
    'sslRoutingEnabled' => true,
    'allowAdminChanges' => true,
    'siteUrl' => 'https://www.etesianwa.com',
    'sslRoutingBaseUrl' => 'https://www.etesianwa.com'
    ],

]; `

selvinortiz commented 4 years ago

Hi @brandondeweese, I apologize for the late reply.

Did you manage to sort this out via Patrol or did you have to do it through NginX/Apache/etc config?

engram-design commented 2 years ago

Closing due to age, but that config looks correct!