algolia / algoliasearch-client-swift

⚑️ A fully-featured and blazing-fast Swift API client to interact with Algolia.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error 494 Header Too Large with some API Keys

jwells89 opened this issue Β· comments

Describe the bug πŸ›
For some users with a large number of permissions (increasing length of the API key), search fails with 494 Header too large.

To Reproduce πŸ”
Steps to reproduce the behavior:

  1. Set up a SearchClient (or SearchClient user from instantsearch-ios) with app ID and API key for user with large number of permissions sent down from back end
  2. Attempt a search
  3. See error

Expected behavior πŸ’­
API key is sent in request body instead, producing no error and successfully searching.

Environment:

  • OS: iOS 15.1
  • Version: instantsearch-ios 7.14.0/algoliasearch-client-swift 8.12.0

Additional context
This appears to have been fixed in the past by conditionally sending the API key in the body of the request instead of the header when maximum key length is exceeded in issue #509, but it appears that this behavior was not re-implemented in a refactor/rewrite that happened at some point since then.

Hi @jwells89,
Thank you for reporting this!
The patch will be released soon.

Thanks a bunch @VladislavFitz!

Anything we can do to help?

Hi @jwells89 , @aleemstreak ,

I have just the PR with a fix.
Could you test it confirm if it works for you? Thanks.

Hi @VladislavFitz,

This fix works great in my testing. Thanks!