Connect method style of HTTP tunnelling / HTTP proxy
2.0.1 Latest release released

Connect Proxy


A simple implementation of the connect method for HTTP tunnelling. Most commonly used in HTTP proxy servers.


The most common usage of this shard is to use the crystal ::HTTP::Client via a proxy server

host = URI.parse("")
response = do |client|
  client.exec("GET", "/")

By default the HTTP client will pick up the https_proxy or http_proxy environment variables and use the URLs configured in there. However you can override the environment or provide your own proxy server.

host = URI.parse("")
client =
proxy ="", 80, {username: "admin", password: "pass"})
response = client.exec("GET", "/")

Forcing Proxy Support

It's possible to simply introduce proxy support to any app by including extensions to the core classes. I wouldn't recommend this unless there are too many libs to patch / you don't control the code directly

# Patches ::HTTP::Client
require "connect-proxy/ext/http-client"

# Patches ::HTTP::Websocket
require "connect-proxy/ext/websocket"

This method requires you to use the standard proxy ENV vars

  github: spider-gazelle/connect-proxy
  version: ~> 2.0.1
License MIT
Crystal >= 0.36.1

Libraries 1

  • libssl: >= 1.0.2

Dependencies 0

Development Dependencies 0

Last synced .
search fire star recently