question

dkhelpling avatar image
dkhelpling asked

Getting "The header Accept-Encoding is managed automatically" warnings

authcode.txt

I'm currently working on a basic Login authentication script, but am getting "The header Accept-Encoding is managed automatically, setting it may have no effect or result in unexpected behavior" warnings when attempting to run my Unity build. I attached a screenshot of the line of code from a Playfab script that it is pointing to. Could someone explain why I am receiving this warning? I'm trying to learn more and do research of why I am receiving it, but haven't found an answer yet. I appreciate the help! The screenshot below is where the warning pointed me, and I also attached a text file of my Authentication code.

Authentication
warning.png (20.6 KiB)
authcode.txt (2.8 KiB)
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Sarah Zhang avatar image
Sarah Zhang answered

This warning should be caused by Unity’s version update. You can compare the documentations of UnityWebRequest.SetRequestHeader with different Unity versions. Here are the Unity 2019.4’s document and Unity 2020.1’s document.

In the Unity 2019.4 version, it says “It is possible to set a custom value for the accept-encoding header but the resulting behavior is unreliable so it is strongly recommended to let it be automatically handled unless you can accept the risk of unexpected results.”, but in the 2020.1 this document says “It is not recommended to set these headers to custom values: accept-charset, accept-encoding, access-control-request-headers, access-control-request-method, connection, date, dnt, expect, host, keep-alive, origin, referer, te, trailer, transfer-encoding, upgrade, via. ” So, we guess Unity added this warning to its 2020.1 version.

Currently, there is no case showing that this warning will make a substantial effect on the use of Unity PlayFab SDK. If you get any error caused by it, please let us know.

If you want a more stable and reliable experience, you can temporarily switch the Unity version to 2019.4.6f1(LTS).

5 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

arycama avatar image arycama commented ·

This is a fairly annoying issue for Playfab GDSK servers.

There are constant warning messages throughout the server logs, which makes it very difficult to debug other issues.

It would be great if you could wrap the code in a preprocessor macro for versions earlier than Unity 2020, so we don't have it cluttering up our logs.

(Logging warnings is also not great for performance on mobile devices as it involves an expensive stack trace. So for client devices it is not desireable either)

0 Likes 0 ·
brendan avatar image brendan arycama commented ·

We are in a discussion with the Unity team on this issue. Long story short, we set the gzip encoding in the header. We handle that in our service in 100% of calls that use it. This is a requirement on our side, as removing it would have performance and cost implications for both developers and players.

The 2020 version of Unity added a warning on the use of gzip in this header, as they do not control whether the backend service in question supports it.

0 Likes 0 ·
Alberto avatar image Alberto brendan commented ·

Is there any update on this? It is really annoying and I'm missing most of the important warnings.
This is how my console looks:

0 Likes 0 ·
Show more comments
Jérémie Fouché avatar image
Jérémie Fouché answered

Hello, i have the same issues, in Unity 2020.1.8f1 , Unity doesnt solve that with the news update?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.