Http.fs icon indicating copy to clipboard operation
Http.fs copied to clipboard

Can't get proxy working

Open ghost opened this issue 4 years ago • 1 comments

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.

ghost avatar Jul 18 '20 15:07 ghost

@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.

ivpadim avatar Jul 18 '20 19:07 ivpadim

It seems that this is still the case. Is that correct?

DavidSSL avatar Dec 16 '22 13:12 DavidSSL

@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

ivpadim avatar Aug 02 '23 08:08 ivpadim