verbb / patrol

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

maintenanceModeAccessTokens doesn't work #19

Closed jesuismaxime closed 5 years ago

jesuismaxime commented 5 years ago

I had add maintenanceModeAccessTokens on my config file (and remove properly the maintenanceModeAuthorizedIps param and I'm not able to make it work.

When I hit my site.com/​?​a​c​c​e​s​s​=​my-token I see the 404 page, when I try to acces another page I'm redirect to the maintenanceModePageUrl page and the IP is not added at the whitelist (I guess the CP "Authorized IPs" section display the actual whitelist).

Here's my patrol.php (note the issue is for the staging env)

<?php

return [
    '*' => [

        // SSL
        'sslRoutingEnabled' => true,
        'sslRoutingRestrictedUrls' => ['/'],
        'sslRoutingBaseUrl' => "https://example.ca",
        //
        'maintenanceModePageUrl' => '/nada-que-ver',
    ],
    'dev' => [
        'maintenanceModeEnabled' => false,
        'sslRoutingEnabled' => false,
        'maintenanceModeAuthorizedIps' => [],
    ],
    'staging' => [
        'maintenanceModeEnabled' => true,
        'maintenanceModeAccessTokens' => [
            'd0nn3bd8a2iza1ikjxxdo28iicabh7ts',
            'test',
        ],
    ],
    'production' => [
    ]
];
selvinortiz commented 5 years ago

@jesuismaxime Can you remove the maintenanceModeAuthorizedIps config from all the environments and let me know if that solves the issue?

jesuismaxime commented 5 years ago

Sorry for the delay, did'nt work on that project since today! Yes, that "solves" the issue, but not working as expected.

selvinortiz commented 5 years ago

@jesuismaxime Can you clarify how you expect it to work and how it's not working that way?

jesuismaxime commented 5 years ago

I expected the env params to work like others in Craft configs: by environment. The way it works now, I cant have a staging environment with maintenanceModeAuthorizedIps and a production environment with maintenanceModeAccessTokens.

And It could be nice to use both maintenanceModeAuthorizedIps and maintenanceModeAccessTokens on a environment.

selvinortiz commented 5 years ago

Got it!

Yes, I agree that it would be nice.

I'll take a look at the level of effort required to make that happen.

However, it won't be something I'll address in the near future.