A customer is trying to run our app in it’s network which is behind a proxy. Normally that’s not an issue when using Unity 2022.1 or above (was a problem before as there was a bug that WebRequest didn’t detected Windows’ automatic proxy settings). But this time the customer uses a proxy which seems to require proxy authentification.
For testing we used two different methods namely WebRequest and HttpClient. The webRequest only returns
Failed to recieve data
whereas the HttpClient is more specific and returns
System.Net.Http.HttpRequestException: An error occured while sending the request ---> System.Net.WebException: (407) Proxy Authentification Required at System.Net.WebConnectionTunnel.Initialize.
Is it possible to pass any credentials (username and password) using Unity’s WebRequest?
I’m not sure how debugging would help me here. Since the error message is quite specific I was expecting that there is some method or something to pass the credentials required for the authentification. Does anybody know whether this is possible?
If nobody has a solution for this you someone at least think about a workaround for this? Is there something like a program which can take the requests of a certain application and redirect them to the proxy server while adding the required credentials?
I figured out so far that the proxy authorization requires a HTML header called “Proxy-Authorization” as described here: Proxy-Authorization - HTTP | MDN
UnityWebRequest allows to set custom headers so I tried to set the header with