Receiving 502 errors when using Cloudflare in front of FusionAuth
-
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?
-
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.
-
D dan has marked this topic as solved