knock-knock icon indicating copy to clipboard operation
knock-knock copied to clipboard

Can't get to work on staging looking for tips to troubleshoot

Open sg-modlab opened this issue 2 years ago • 4 comments

Question

Do you have any tips to troubleshoot this not working on staging?

Additional context

We use Knock Knock on a host of sites to protect access on our staging server. All to date have been working great with no issue. I have a redesign site that we recently pushed to staging for review and Knock Knock is not working on staging. There are no errors and I'm a little baffled by it. There is a single site.

I am using the config copied direct from the docs.

Locally my .env is set to dev.

ENVIRONMENT=dev

When i change my knock-knock.php config to the following:

'dev' => [ 'enabled' => true, ],

The site is properly locked. Yeah!

When I change config back to:

'staging' => [ 'enabled' => true, ],

and then update my .env to:

ENVIRONMENT=staging

The site is not locked. Boo!

This in essence is what I am seeing on my actual staging server. Struggling to find a cause so thought I'd reach out for troubleshooting advice.

sg-modlab avatar Apr 12 '23 15:04 sg-modlab

Can't think of a reason why that wouldn't work (it's working for me with that reduced case. Only thing worth considering is that if you're logged in, it'll bypass the challenge screen?

I'd also just double check all your other Knock Knock settings just in case.

engram-design avatar Apr 13 '23 11:04 engram-design

Not sure if relevant in this case, but thought I'd mention it in case it is: I had the issue with knock knock not locking a page in production, but working fine locally.

The reasoning was that the BASE_URL was not the same as the accessed url. Specifically I was hosting the site at Fortrabbit, and had previously used their given url projectname.frb.io, and only recently routed the correct domain. Thereafter I had added a htaccess redirect from the frb.io domain to the actual domain, but forgotten to change the BASE_URL.

Obviously an error on my side, but worth mentioning just in case someone else also do the same 🙂

eddiedale avatar Jun 13 '23 05:06 eddiedale