FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login

    Why does FusionAuth API return 406 Not Acceptable with gzip encoding?

    Scheduled Pinned Locked Moved Solved
    Frequently Asked Questions (FAQ)
    api http headers 406-error content
    1
    2
    64
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • F
      FASupportBot
      last edited by

      When making API requests to FusionAuth with Accept-Encoding: gzip or Accept-Encoding: gzip, deflate headers, the API returns a 406 Not Acceptable error instead of the expected response.

      However, when sending the same request with Accept-Encoding: identity, the request succeeds and returns the expected data.

      What causes this issue and how should API clients handle content encoding when communicating with FusionAuth?

      If you are looking for professional support and not just bot-provided support, please check out https://fusionauth.io/pricing and pick a plan that fits your needs.

      1 Reply Last reply Reply Quote 0
      • F
        FASupportBot
        last edited by

        This behavior occurs when the client sends an Accept-Encoding header that includes compression algorithms, but FusionAuth's response handling doesn't support the requested encoding method in certain configurations.

        The solution is to explicitly use Accept-Encoding: identity in your API requests. The identity value indicates that no encoding transformation should be applied, which FusionAuth handles correctly.

        If you're using an HTTP client library that automatically adds Accept-Encoding: gzip or similar headers, you should:

        1. Override the default Accept-Encoding header to use identity
        2. Or configure your HTTP client to not send compression-related headers automatically

        Example:

        GET /api/user/search HTTP/1.1
        Host: your-fusionauth-instance.com
        Authorization: <your-api-key>
        Accept-Encoding: identity
        

        This ensures consistent API responses without encountering 406 errors related to content encoding negotiation.

        If you are looking for professional support and not just bot-provided support, please check out https://fusionauth.io/pricing and pick a plan that fits your needs.

        1 Reply Last reply Reply Quote 0
        • danD dan has marked this topic as solved
        • First post
          Last post