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

Allow multiple hosts to work around firewall blocks #149

Open
aldenquimby opened this issue May 23, 2024 · 2 comments
Open

Allow multiple hosts to work around firewall blocks #149

aldenquimby opened this issue May 23, 2024 · 2 comments

Comments

@aldenquimby
Copy link

Background

  • Most of our customers are government agencies, who tend to have very restrictive firewalls
  • For about 5% of our users, api.knock.com gets blocked, so Knock does not work
  • We've been fixing this historically by getting customer IT on the phone and having them add Knock to their allowlist
  • But this slows down our implementation, and leads to poor initial UX (notifications don't work at first)

Reverse Proxy

  • The existing KnockOption.host let's us work around this, which is great
  • We've setup mysite.com/tunnel/knock as a reverse proxy to api.knock.com, and now the firewall blocks are gone
  • But this adds latency for 100% of our users to fix a problem that only 5% have

Ask

  • We'd like a way to say "use my reverse proxy host, but only if the default host is failing"
  • Example React API:
<KnockProvider hosts={['https://api.knock.app', 'https://mysite.com/tunnel/knock']} ...

Implementation Ideas

  • it looks like this logic could be entirely contained to ApiClient
  • in the catch of makeRequest (so after 3 failures), if there are multiple hosts, we could re-create axiosClient and socket using the next host in the list, and then try again
  • I'd be glad to try a PR with this if it sounds ok
@connorlindsey
Copy link
Contributor

Hey @aldenquimby, thanks for the detailed issue! This would definitely be a nice improvement to the api client but not something we can immediately tackle. If you'd be willing to open a PR, that would be amazing! One note is that we'd prefer to update the host param to accept a string or array rather than introduce an additional property.

@aldenquimby
Copy link
Author

Thanks @connorlindsey , I'll give it a shot!

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

2 participants