Bug Description
Custom user agents do not return server flags unless that user agent is mocking a known such as curl. This is annoying as it forces languages that do not have an official SDK to pretend to be a different library/client.
How to reproduce
Using curl make a request without a setting a custom user agent. Curl sets its own User Agent and thats recognized by Posthog.
curl https://us.i.posthog.com/flags/?v=2 \
-X POST \
-H 'Content-Type: application/json' \
-d '{
"api_key": "[API_KEY]",
"distinct_id": "[user distinct id]"
}'
This will return server flags.
Now set a custom user agent
curl https://us.i.posthog.com/flags/?v=2 \
-X POST \
-H 'Content-Type: application/json' \
-H 'User-Agent: this-is-not-accepted' \
-d '{
"api_key": "[API_KEY]",
"distinct_id": "[user distinct id]"
}'
This will only return flags marked for all environments.
Additional context
Debug info