# Using Net::HTTP to proxy HTTPS

**URL:** <https://www.ruby-forum.com/t/using-net-http-to-proxy-https/129606>\
**Category:** Ruby\
**Created:** [February 20, 2008, 1:16am UTC](https://www.ruby-forum.com/t/using-net-http-to-proxy-https/129606 "2008-02-20T01:16:40Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![lcox](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/dbc845/32.png) [@lcox](https://www.ruby-forum.com/u/lcox)\
**Post date:** [February 20, 2008, 1:16am UTC](https://www.ruby-forum.com/t/using-net-http-to-proxy-https/129606/1 "2008-02-20T01:16:40Z")

</div>

As far as I can tell from my experimenting, there is no way to proxy  
HTTPS requests using the Net::HTTP classes. My question is: can it be  
done? And if so, how?

I’ve tried numerous variations, but the main gist of what I’ve tried is  
this code fragment:

httpobj = Net::HTTP.new( host, port )

# this Proxy version below doesn’t work to post to an HTTPS url through

a proxy even though

# it’s supposed to have

# the same methods as Net::HTTP, errors with a use\_ssl is not a method

# httpobj = Net::HTTP.Proxy( @proxy\_host, @proxy\_port, @proxy\_user,

@proxy\_password )

httpobj.use\_ssl = true

httpobj.start do | http |

```
request = Net::HTTP::Post.new(path)
request.set_form_data({ "scan[scan_results]" => "#{results}" } )
response = http.request(request)

```

end

Proxying normal HTTP requests works fine. Using HTTPS with no proxying  
works fine, but
