Adding Custom Headers/Cookies to the UnityWebRequest.Post

Dear developers, I have problems about adding custom headers to my web requests. I would be appreciated if you help me.

UnityWebRequest www = UnityWebRequest.Post(Url, form);
        www.SetRequestHeader("cookie", "sid=" + SessionManager.Instance.User.Sid);
        www.SetRequestHeader("cookie", "proxyAddress=" + SessionManager.Instance.User.ProxyAdress);
        www.SetRequestHeader("cookie", "ruleVersion=" + SessionManager.Instance.User.RuleVersion);
        www.SetRequestHeader("cookie", "downloadManagerAddress=" + SessionManager.Instance.User.DownloadManagerAdress);

If I use the “cookie” as request header name it gives that error : Refused to set unsafe header “cookie”

UnityWebRequest www = UnityWebRequest.Post(Url, form);
        www.SetRequestHeader("Cookie", "sid=" + SessionManager.Instance.User.Sid);
        www.SetRequestHeader("Cookie", "proxyAddress=" + SessionManager.Instance.User.ProxyAdress);
        www.SetRequestHeader("Cookie", "ruleVersion=" + SessionManager.Instance.User.RuleVersion);
        www.SetRequestHeader("Cookie", "downloadManagerAddress=" + SessionManager.Instance.User.DownloadManagerAdress);

If I use “Cookie” as a request header name it gives that error: InvalidOperationException: Cannot override system-specified headers

I’m trying to build for WebGL.I in the scriptingAPI Unity says UnityWebRequest class is supported at WebGL.

Dear develepoers pls help me about that. Is it not available adding custom headers to the UnityWebRequest. If so, I need to change my backend services so need to know. It is boring if it does not support adding custom headers waste of time.

I Still have taking that error
114195-silinecek.png

with that code;

webRequest.SetRequestHeader("Cookie", "sid=" + SessionManager.Instance.User.Sid + ";" +"proxyAddress=" + SessionManager.Instance.User.ProxyAdress + ";" + "ruleVersion=" + SessionManager.Instance.User.RuleVersion + ";" +                                                                   "downloadManagerAddress=" + SessionManager.Instance.User.DownloadManagerAdress);

Hi, @berkanmamak !! I hope you are doing well!

I’m really sorry to see that anybody has answered you.

I’m facing the same problem, I don’t know how to solve it, and I’d like to know how you have fixed it!

I hope you see this message!

I really appreciate any help you can provide.