API returns 403 for Apache-HttpClient User-Agent header

The API seems to return 403 when used with Apache-HttpClientas User-Agent header, but works with anything else that I have tried so far.

Is this the expected behaviour, is there some filter in the API server or in CloudFlare to disallow some user-agents?

This is somewhat annoying, because PyCharm’s HTTP Client defaults to User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.9) (on it’s current version).

However it’s easy to get around this, since even an empty string sent as said header solves the problem.

To reproduce:

curl -X 'GET' 'https://api.materialsproject.org/heartbeat' -H 'User-Agent: Apache-HttpClient/4.5.14 (Java/17.0.9)'

returns {"message":"Forbidden"} to me

However

curl -X 'GET' 'https://api.materialsproject.org/heartbeat' -H 'User-Agent: ..'

returns {"status":"OK","time":"2023-12-26T11:01:00.731164","version":"0.75.1.dev3+g6f05d81d","pymatgen":"2023.12.18","db_version":"2023.11.1","suffix":"green"}

Thanks for reaching out. I just allowed the Apache-HttpClient user agent. It should be working now.