My understanding is that this header is dependent on certain CORS rules or something like that, and browsers may complain if clobbering their built-in User-Agent header.
Would it be possible to use some other header for this, if you need to track SDK usage metric or whatever? Something like X-User-Agent or something random like that would make it not conflict with the browser, I think. If you're using it for metrics in your backend, then you could just do something like headers['X-User-Agent'] ?? headers['User-Agent'] grabbing the first defined one.
We get
Refused to set unsafe header "user-agent"
when using the SDK in Chrome (to calllobbyV3.listActivePublicLobbies
and such).https://github.com/hathora/cloud-sdk-typescript/blob/febd2a75966faffa79569153fab7e00d1d735945/src/sdk/lobbiesv2.ts#L64
My understanding is that this header is dependent on certain CORS rules or something like that, and browsers may complain if clobbering their built-in
User-Agent
header.Would it be possible to use some other header for this, if you need to track SDK usage metric or whatever? Something like
X-User-Agent
or something random like that would make it not conflict with the browser, I think. If you're using it for metrics in your backend, then you could just do something likeheaders['X-User-Agent'] ?? headers['User-Agent']
grabbing the first defined one.