Http.fs
Http.fs copied to clipboard
Can't get proxy working
Hi!
Example shows that there is an ability to make requests going through proxy with setting of proxy server via Request.proxy. However, the functionality seems to be not working. I haven't found proxy creation in source code. It looks like the call above just creates proxy record which is not being used anywhere in the code.
@Denterl you have to create your own HttpClient and a HttpClientHandler with the proxy setup you need.
Then you can pass your new HttpClient to the api while creating the request using the method createWithClient.
It seems that this is still the case. Is that correct?
@DavidSSL here is how I setup my proxy client (using fiddler everywhere)
let proxyHttpClient() =
let handler = new SocketsHttpHandler(UseCookies=true)
handler.Proxy <- new WebProxy("127.0.0.1", 8866)
let options = SslClientAuthenticationOptions()
options.RemoteCertificateValidationCallback <- fun _ _ _ _ -> true
handler.SslOptions <- options
let client = new HttpClient(handler)
client.DefaultRequestHeaders.Clear()
client