Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Plugin is forcing a redirect to base URI for site #43

Open
JonGoldmanPlaybill opened this issue Jun 23, 2021 · 5 comments
Open

Plugin is forcing a redirect to base URI for site #43

JonGoldmanPlaybill opened this issue Jun 23, 2021 · 5 comments

Comments

@JonGoldmanPlaybill
Copy link

I have a site that responds to multiple subdomains within the same site (e.g., domain.com, sub1.domain.com, sub2.domain.com, etc.). When I enable knock-knock every request is redirected to domain.com

In the protected URLs I have the following entries:

  • domain.com/(.*)
  • sub1.domain.com/(.*)

I'm not using a config file, but it is my understanding that the forced redirect is not supposed to take effect unless I enable it with a config php file manually.

Can you explain this behavior?

@engram-design
Copy link
Member

Hmmm, so it should be taking into account the referrer URL and redirect based on that. I'll double check this for multi-site situations. It might be that it can't detect (properly) the site you're trying to access.

You shouldn't need a config file for the most part, and the forcedRedirect is really there as an override to redirect to. This wouldn't be what you'd want in your case, as it would redirect everything to a single static URL, which is what's happening.

And just to clarify, when you mention it's redirected to domain.com - is that to enter the password to access the site, or after entering in the password to access the site, you're afterwards redirected to domain.com (despite accessing from a subdomain, etc)

@JonGoldmanPlaybill
Copy link
Author

@engram-design It is redirecting for both. Note that I do not use multi-site in Craft 3, I am simply allowing multiple subdomains to come into the same site. So I believe it is using the default URL from the .env file instead of the actual referring URL.

@engram-design
Copy link
Member

Gotcha. I've fixed the referrer redirect issue.

The only issue with this is that it's a little more complicated for multiple domains. We would need to change the mechanism for remembering that you've logged in successfully across multiple subdomains, which I'll need to look into. Right now, even with this fix, you'll be redirected correctly after logging in, but it'll prompt you to login again, as it won't have remembered you on the subdomains.

@engram-design
Copy link
Member

Fixed the referrer issue in 1.2.15

@jan-dh
Copy link

jan-dh commented Sep 30, 2024

@engram-design what would be the right approach for multiple domains? I have a multi-site setup with sitegroup 1 - 8 sites on 1 domain, sitegroup 2: 4 sites on a second domain; can't seem to get knock-knock to work cross domain atm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants