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

    Receiving 502 errors when using Cloudflare in front of FusionAuth

    Scheduled Pinned Locked Moved Solved
    Q&A
    502 proxy cloudflare error
    1
    2
    18
    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.
    • danD
      dan
      last edited by

      We were using a FusionAuth cloud deployment directly but now want to use Cloudflare in front of it.

      We are now seeing intermittent, infrequent 502 errors.

      We see errors like this in the logs

      2025-06-24 14:05:09.345 PM ERROR io.fusionauth.http.server.HTTPServerThread - An exception was thrown during processing
      java.lang.IllegalArgumentException: Not a valid Unicode code point: 0xFFFFFFC3 
      

      How can we resolve this?

      --
      FusionAuth - Auth so modern you can download it.
      https://fusionauth.io

      danD 1 Reply Last reply Reply Quote 0
      • danD
        dan @dan
        last edited by dan

        This is due to non-ASCII characters in headers causing an issue in the FusionAuth parsing code. Cloudflare sends headers with non-ASCII characters (such as cf-region: São Paulo) which triggers this issue.

        This is a java-http bug that was fixed in 2024, and released in FusionAuth version 1.51.2.

        So, two options:

        • upgrade to a version of FusionAuth 1.51.2 or newer. This is the recommended approach, but may require some work.
        • as an interim workaround, you can disable the "Add visitor location headers" option from your CloudFlare console. This should not have any negative impact, since we do not inspect those headers.

        --
        FusionAuth - Auth so modern you can download it.
        https://fusionauth.io

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