---
title: "HTTPS Proxy URL vs HTTP Proxy: TLS to the Proxy"
description: "An https:// proxy URL encrypts the hop to the proxy, credentials included. How it differs from http:// with CONNECT, and which clients support it today."
canonical: https://fixedmark.com/blog/https-proxy-endpoints-tls-to-the-proxy
updated: 2026-11-10
source: Fixedmark (https://fixedmark.com), BitMask LLP
---

Networking · 11 min read

# HTTPS Proxy URL vs HTTP Proxy: TLS to the Proxy

An \`https\://\` proxy URL makes your client open TLS to the proxy before it sends anything, so the CONNECT line and the \`Proxy-Authorization\` credentials travel inside that TLS session. With an \`http\://\` proxy URL your HTTPS traffic is still encrypted inside the tunnel, but the proxy credentials cross the network as base64 text. curl, Node undici, Python requests and httpx, Go, and PHP support https\:// proxies. Java's built-in HttpClient does not.

## Two schemes, two different hops

A proxied request has two URLs, and each scheme controls a different hop. The proxy URL's scheme decides how your client talks to the proxy. The destination URL's scheme decides how your client talks to the server behind it.

For an `https://` destination, the client always asks the proxy for a `CONNECT` tunnel and then runs TLS with the destination inside it. That part is the same whatever the proxy URL says. The [CONNECT explainer](https://fixedmark.com/blog/http-connect-proxy-explained) walks through those bytes. What changes with an `https://` proxy URL is the layer under the tunnel. The client opens a TLS session with the proxy first, and everything it says to the proxy goes inside that session.

_What an observer between your app and the proxy can read_

| Proxy URL  | Destination | Proxy credentials | Request content                          |
| ---------- | ----------- | ----------------- | ---------------------------------------- |
| `http://`  | `https://`  | Readable (base64) | Encrypted by your TLS to the destination |
| `https://` | `https://`  | Encrypted         | Encrypted twice (TLS inside TLS)         |
| `http://`  | `http://`   | Readable (base64) | Readable, full request                   |
| `https://` | `http://`   | Encrypted         | Encrypted to the proxy, plain after it   |

The first row is the common setup, and it is why many engineers assume a plain proxy is safe for HTTPS. Your API payloads are safe in that row. Your proxy password is not.

## Why cleartext proxy credentials matter

Proxies authenticate with the `Proxy-Authorization` header, most often with the Basic scheme. Basic is base64, which is an encoding, not encryption. [RFC 7617](https://www.rfc-editor.org/rfc/rfc7617.html) says plainly that Basic results in the cleartext transmission of the password and should not be used without something like TLS around it. Oracle's [Java networking guide](https://docs.oracle.com/en/java/javase/21/core/java-networking.html) uses nearly the same words for proxies.

Here is the header curl sent in a test through a local proxy with the user `app` and the password `secret`, and what one shell command turns it back into.

**Terminal**

```bash
> CONNECT example.com:443 HTTP/1.1
> Host: example.com:443
> Proxy-Authorization: Basic YXBwOnNlY3JldA==

$ echo 'YXBwOnNlY3JldA==' | base64 -d
app:secret
```

A fixed-IP egress proxy raises the stakes. The whole point of the proxy is that a bank, broker, or partner API trusts its IP address. Anyone who captures the token can send traffic from that trusted address, from anywhere. The partner's allowlist then admits them, and the logs show your IP.

Who sits on that first hop depends on where your code runs. It can be a hosting platform's shared network, a cloud provider's backbone, a corporate network with inspection boxes, or public Wi-Fi on a developer laptop. You rarely control all of it. An `https://` proxy URL removes the question, because nothing readable crosses the hop.

TLS to the proxy also hides the `CONNECT` line itself from the network. That matters less than it sounds, since the TLS handshake inside the tunnel carries the destination name in SNI to the proxy anyway. The credentials are the real gain.

## What happens on an https\:// proxy connection

1. 1

   **TCP to the proxy** The client connects to the proxy host. curl assumes port 443 for an `https://` proxy without a port, per [Everything curl](https://everything.curl.dev/usingcurl/proxies/https.html). Defaults differ between clients, so write the port in the URL.
2. 2

   **TLS with the proxy** The client sends SNI for the proxy's host name and verifies the proxy's certificate against its trust store. This is a separate check from the destination's certificate.
3. 3

   **CONNECT inside TLS** The client sends `CONNECT api.partner.example:443` and the `Proxy-Authorization` header inside the encrypted session. The proxy decrypts this layer, checks the credentials, opens a TCP connection to the destination, and replies `200`.
4. 4

   **TLS with the destination, inside the first TLS** The client starts a second handshake with the destination through the tunnel. The proxy relays those records without keys for them. Your request and response travel encrypted twice on the first hop and once after the proxy.

The extra cost is one more TLS handshake each time the client opens a new connection to the proxy. A client that keeps connections alive pays it once and then sends many requests through the same tunnel. Create the agent or client once and reuse it, especially on serverless platforms where each cold start already pays for new connections.

Running TLS inside TLS needs the client library to layer one session on another. Some runtimes could not do that for years. asyncio before Python 3.11 is one example, and it explains the aiohttp row in the next section. The [TLS passthrough post](https://fixedmark.com/blog/tls-passthrough-zero-knowledge-proxy) covers what the proxy can still see once the inner session is up.

## Which clients support HTTPS proxies

Support is wide on current versions and patchy on older ones. The version floors below come from each project's release notes and from the Fixedmark language guides, which were tested against a TLS-wrapped CONNECT proxy.

_https\:// proxy URL support by client_

| Client                                         | https\:// proxy           | Notes                                                                                                                                                                 |
| ---------------------------------------------- | ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| curl and libcurl                               | Yes, since 7.52.0         | Added in December 2016 per the [curl changelog](https://curl.se/changes.html) . Works with OpenSSL, GnuTLS, and, from 7.87.0, mbedTLS, Rustls, Schannel, and wolfSSL. |
| PHP cURL and Guzzle                            | Yes, with libcurl 7.52.0+ | Check `CURL_VERSION_HTTPS_PROXY` in `curl_version()`. See the [PHP guide](https://fixedmark.com/docs/php) .                                                           |
| Node.js undici `ProxyAgent`                    | Yes                       | TLS to the proxy, then CONNECT, per the [undici docs](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md) .                                       |
| Node.js built-in proxy                         | Yes, 22.21+ and 24.5+     | `NODE_USE_ENV_PROXY=1` with `HTTPS_PROXY`. The [Node docs](https://nodejs.org/api/http.html#built-in-proxy-support) list both http and https proxy URLs.              |
| Node.js `https-proxy-agent`                    | Yes                       | For the `https` module, axios, and SDKs that take an agent. See the [Node guide](https://fixedmark.com/docs/node) .                                                   |
| Python requests                                | Yes, with urllib3 1.26+   | urllib3 1.26.0 added HTTPS proxies to HTTPS servers, per its [changelog](https://urllib3.readthedocs.io/en/stable/changelog.html) .                                   |
| Python httpx                                   | Yes                       | Use 0.28 or later and the `proxy` argument. See the [Python guide](https://fixedmark.com/docs/python) .                                                               |
| Python aiohttp                                 | Yes, on Python 3.11+      | Older asyncio cannot run TLS inside TLS. The [aiohttp docs](https://docs.aiohttp.org/en/stable/client_advanced.html) call the support limited.                        |
| Go `net/http`                                  | Yes, since Go 1.10        | Per the [Go 1.10 release notes](https://go.dev/doc/go1.10) . See the [Go guide](https://fixedmark.com/docs/go) .                                                      |
| Deno and Bun `fetch`                           | Yes                       | Deno through `Deno.createHttpClient`, Bun through the `proxy` fetch option. See the [Deno and Bun guide](https://fixedmark.com/docs/deno-and-bun) .                   |
| Ruby Typhoeus                                  | Yes                       | Runs on libcurl. See the [Ruby guide](https://fixedmark.com/docs/ruby) .                                                                                              |
| Ruby `Net::HTTP` and Faraday's default adapter | Partial                   | net-http 0.5.0 added TLS to the proxy, but HTTPS destinations still failed in testing.                                                                                |
| Java `HttpClient` and `HttpURLConnection`      | No                        | Connects to proxies over plain TCP only. See the [Java guide](https://fixedmark.com/docs/java) .                                                                      |

Here is the same call in each language that supports it. The proxy URL comes from an environment variable in the form `https://USER:TOKEN@proxy.example.com:443`. Percent-encode the token if it contains reserved characters.

**curl**

```bash
curl -v --proxy "$PROXY_URL" https://api.partner.example/v1/status
```

**Node.js**

```javascript
import { fetch, ProxyAgent } from "undici";

// Create once at module scope and reuse.
const proxy = new ProxyAgent(process.env.PROXY_URL);

const res = await fetch("https://api.partner.example/v1/status", {
  dispatcher: proxy,
});
console.log(res.status);
```

**Python**

```python
import os

import requests

proxy = os.environ["PROXY_URL"]
r = requests.get(
    "https://api.partner.example/v1/status",
    proxies={"http": proxy, "https": proxy},
    timeout=15,
)
print(r.status_code)
```

**Go**

```go
package main

import (
	"fmt"
	"net/http"
	"net/url"
	"os"
	"time"
)

func main() {
	proxyURL, err := url.Parse(os.Getenv("PROXY_URL"))
	if err != nil {
		panic(err)
	}
	client := &http.Client{
		Transport: &http.Transport{Proxy: http.ProxyURL(proxyURL)},
		Timeout:   15 * time.Second,
	}
	res, err := client.Get("https://api.partner.example/v1/status")
	if err != nil {
		panic(err)
	}
	defer res.Body.Close()
	fmt.Println(res.StatusCode)
}
```

**PHP**

```php
<?php
$ch = curl_init('https://api.partner.example/v1/status');
curl_setopt_array($ch, [
    CURLOPT_PROXY          => getenv('PROXY_URL'),
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CONNECTTIMEOUT => 10,
    CURLOPT_TIMEOUT        => 15,
]);
curl_exec($ch);
echo curl_getinfo($ch, CURLINFO_RESPONSE_CODE), PHP_EOL;
```

**Ruby**

```ruby
require "typhoeus"

res = Typhoeus.get(
  "https://api.partner.example/v1/status",
  proxy: ENV.fetch("PROXY_URL"),
  timeout: 15
)
puts res.code
```

When a client that cannot do TLS to a proxy is pointed at a TLS port, it sends plain text into a TLS listener. The result is a handshake error, a reset, or a hang, rarely a clear message. The [proxy error codes guide](https://fixedmark.com/blog/proxy-error-codes-explained) covers how to tell these apart with `curl -v`.

## Trusting the proxy's certificate

A proxy with a certificate from a public CA needs no extra setup. Every client above verifies it against the default trust store. A proxy with a private CA, common inside companies, needs that CA on the proxy hop. Each client exposes this differently, and the differences cause real bugs.

- curl keeps the two hops apart. `--proxy-cacert` sets trust for the proxy only, and the [curl man page](https://curl.se/docs/manpage.html) describes it as a different trust for the proxy compared to the remote server. `--cacert` still applies to the destination.
- PHP has the same split through `CURLOPT_PROXY_CAINFO`, which the [PHP manual](https://www.php.net/manual/en/curl.constants.php) says is for connecting to an HTTPS proxy, not an HTTPS server.
- undici takes `proxyTls` for the proxy hop and `requestTls` for the destination. `https-proxy-agent` passes its TLS options, such as `ca`, to the proxy connection.
- httpx takes an `ssl_context` on `httpx.Proxy`, separate from the client's `verify` setting.
- requests has no separate option. In a test with requests on urllib3 2.x, the `verify` bundle was used for both hops. Pointing it at the private CA alone made the destination fail, so the bundle must hold the public roots plus your CA.
- Go uses one `TLSClientConfig` for both hops. Add your CA to `RootCAs` on top of the system pool. Do not set `ServerName`, because Go then checks that name against the proxy's certificate too.

**The Go ServerName trap**

```go
// Breaks the proxy hop. ServerName is used for BOTH handshakes.
tr := &http.Transport{
	Proxy:           http.ProxyURL(proxyURL),
	TLSClientConfig: &tls.Config{ServerName: "example.com"},
}
// Get "https://example.com": proxyconnect tcp: tls: failed to verify
// certificate: x509: certificate is valid for localhost, not example.com
```

Never fix a proxy certificate error by turning verification off with `--proxy-insecure`, `CURLOPT_PROXY_SSL_VERIFYPEER` set to false, or `rejectUnauthorized: false`. The [curl man page](https://curl.se/docs/manpage.html) warns that it makes the transfer to the proxy insecure. An attacker on the path can then present any certificate, collect your token, and you are back to cleartext with extra steps.

## HTTPS_PROXY names the destination, not the proxy

The variable `HTTPS_PROXY` means the proxy to use for HTTPS destinations. It says nothing about how to reach the proxy. The [curl man page](https://curl.se/docs/manpage.html) defines it as the proxy server to use for HTTPS. The value is a URL, and its own scheme picks the hop. So both of these are valid and do different things.

**Terminal**

```bash
# HTTPS destinations through a plain proxy. Credentials in cleartext.
export HTTPS_PROXY="http://USER:TOKEN@proxy.example.com:8080"

# HTTPS destinations through a TLS proxy. Credentials encrypted.
export HTTPS_PROXY="https://USER:TOKEN@proxy.example.com:443"
```

The same confusion shows up in Python. The `https` key in a requests `proxies` dict selects HTTPS destinations, and its value can be an `https://` proxy URL. The [requests docs](https://requests.readthedocs.io/en/latest/user/advanced/) show `http://` values in their examples, and the [httpx proxy docs](https://www.python-httpx.org/advanced/proxies/) advise `http://` because most proxies only support that. Those examples describe typical corporate proxies. They do not mean an `https://` value is wrong.

Watch for a missing scheme. Go's [ProxyFromEnvironment](https://pkg.go.dev/net/http#ProxyFromEnvironment) accepts a bare `host:port` and assumes `http`. curl treats a proxy with no scheme as an HTTP proxy. If a deploy script strips `https://` from the value, nothing errors. The client quietly sends your token in cleartext to a port that expects TLS, and the request fails in a confusing way. Keep the full URL, scheme and port included.

Global variables also proxy calls you did not mean to proxy. Per-client configuration avoids that, as the post on [NO_PROXY and per-client agents](https://fixedmark.com/blog/selective-proxying-no-proxy-and-per-client-agents) explains.

## When a client cannot do TLS to the proxy

Java is the big gap. `java.net.http.HttpClient` takes a `ProxySelector` that returns a host and port, and it always connects there over plain TCP. A [write-up of the JDK source](https://dev.to/kdrakon/httpclient-can-t-connect-to-a-tls-proxy-118a) traces this to the tunnel classes, and Maven's [transporter known issues](https://maven.apache.org/resolver/transporter-known-issues.html) list no TLS proxy support for the JDK client. The JDK also disables Basic auth for CONNECT tunnels by default through `jdk.http.auth.tunneling.disabledSchemes`, so a plain proxy returns `407` until you clear that property. Ruby's `Net::HTTP` is the other common case, as the [Ruby guide](https://fixedmark.com/docs/ruby) describes.

You have three practical options, from best to worst.

1. Switch the allowlisted calls to a client that supports `https://` proxies. In Ruby, Typhoeus covers this. In Java, check your third-party HTTP client's documentation and test it against a TLS proxy before relying on it.
2. Wrap the hop in TLS locally. A small forwarder on `127.0.0.1` accepts the plain connection and opens TLS to the proxy, so cleartext never leaves the machine. The `socat` command below did this for Java's `HttpClient` in a test, and it verified the proxy's certificate and host name by default.
3. Use the plain proxy port and limit the damage. Restrict what the credential can reach, rotate it on a schedule (see [rotating proxy credentials](https://fixedmark.com/blog/rotating-proxy-credentials-without-downtime)), and keep the hop inside networks you trust as far as you can.

**Local TLS wrapper for a plain-only client**

```bash
# Listens in plain text on loopback, speaks TLS to the proxy.
socat TCP-LISTEN:3128,bind=127.0.0.1,reuseaddr,fork \
  OPENSSL:proxy.example.com:443

# Point the client at 127.0.0.1:3128 as a plain HTTP proxy.
# Java HttpClient also needs Basic auth for tunnels turned back on:
#   -Djdk.http.auth.tunneling.disabledSchemes=
```

The wrapper runs as a sidecar process next to your app. It suits a VM or container you control. It does not fit platforms where you cannot run a second process.

## Check which kind of proxy hop you have

Run `curl -v` with your proxy URL and read the lines before `CONNECT`. A TLS proxy hop shows a handshake and a `Proxy certificate` block first, then the `CONNECT` request, then a second handshake with the destination's `Server certificate`. A plain hop goes straight from the TCP connection to `CONNECT`, with no proxy certificate in between.

**curl -v through a TLS proxy (trimmed)**

```
* Proxy certificate:
*   subject: CN=localhost
*   issuer: CN=Test Proxy CA
* Establishing HTTP proxy tunnel to example.com:443
> CONNECT example.com:443 HTTP/1.1
< HTTP/1.1 200 Connection Established
* CONNECT tunnel established, response 200
* Server certificate:
*   subject: CN=example.com
```

Then check your application, not only curl. Log the proxy URL's scheme and port at startup with the credentials masked, and fail fast if the scheme is not `https`. It is one line of code and it catches the stripped-scheme bug before it reaches production.

## Doing this with Fixedmark

Fixedmark, in early access, gives outbound calls a fixed pair of static IPs that partners allowlist. Its proxy URL is an `https://` endpoint, so the default setup already encrypts the token on the first hop. The [concepts page](https://fixedmark.com/docs/concepts#tls-endpoint) covers the details.

- The HTTP proxy over TLS listens on port 443, in the form `https://APP_ID:TOKEN@mum.egress.fixedmark.com:443`. SOCKS5 over TLS listens on port 1443.
- Ports 8080 (HTTP) and 1080 (SOCKS5) are plain, for clients that cannot do TLS. They send the token in cleartext, so use them only when you have to.
- A [destination allowlist](https://fixedmark.com/docs/allowlists) restricts a credential to the hosts and ports you name, such as `api.razorpay.com:443`. A leaked token from a plain port then cannot reach anything else.
- `fm tunnel` forwards local ports to databases and TCP services over TLS, for drivers with no proxy support. See the [CLI reference](https://fixedmark.com/docs/cli).
- The proxy passes your TLS session with the destination through without decrypting it. The [security page](https://fixedmark.com/security) explains what is logged.

The [Node](https://fixedmark.com/docs/node), [Python](https://fixedmark.com/docs/python), [Go](https://fixedmark.com/docs/go), [PHP](https://fixedmark.com/docs/php), [Ruby](https://fixedmark.com/docs/ruby), [Deno and Bun](https://fixedmark.com/docs/deno-and-bun), and [Java](https://fixedmark.com/docs/java) guides show the tested setup for each client. If a call fails at the TLS step, the [troubleshooting guide](https://fixedmark.com/docs/troubleshooting#tls) lists the symptoms of a client that does not support `https://` proxies.

## Sources

Checked November 2026. Confirm current details on the vendor's site before you decide. Prices and limits change.

- [RFC 7617: The Basic HTTP Authentication Scheme](https://www.rfc-editor.org/rfc/rfc7617.html)
- [curl: command line manual (proxy and proxy TLS options)](https://curl.se/docs/manpage.html)
- [curl: changelog, 7.52.0 adds HTTPS proxy support](https://curl.se/changes.html)
- [Everything curl: HTTPS proxy](https://everything.curl.dev/usingcurl/proxies/https.html)
- [undici: ProxyAgent documentation](https://github.com/nodejs/undici/blob/main/docs/docs/api/ProxyAgent.md)
- [Node.js: built-in proxy support](https://nodejs.org/api/http.html#built-in-proxy-support)
- [urllib3: changelog, 1.26.0 HTTPS proxy support](https://urllib3.readthedocs.io/en/stable/changelog.html)
- [Requests: advanced usage, proxies](https://requests.readthedocs.io/en/latest/user/advanced/)
- [HTTPX: proxies](https://www.python-httpx.org/advanced/proxies/)
- [aiohttp: advanced client usage, proxy support](https://docs.aiohttp.org/en/stable/client_advanced.html)
- [Go 1.10 release notes: https proxy URLs](https://go.dev/doc/go1.10)
- [Go: net/http ProxyFromEnvironment](https://pkg.go.dev/net/http#ProxyFromEnvironment)
- [PHP manual: cURL constants](https://www.php.net/manual/en/curl.constants.php)
- [Oracle: Java networking properties](https://docs.oracle.com/en/java/javase/21/core/java-networking.html)
- [Maven Resolver: transporter known issues](https://maven.apache.org/resolver/transporter-known-issues.html)
- [DEV: HttpClient can't connect to a TLS proxy](https://dev.to/kdrakon/httpclient-can-t-connect-to-a-tls-proxy-118a)

Keep reading

## Related guides

- [Guide Fixedmark security TLS proxy endpoints, passthrough to the destination, and what is logged.](https://fixedmark.com/security)
- [Guide Fixedmark docs Proxy URLs, protocols, and tested setups for each language.](https://fixedmark.com/docs)
- [Use case Partner API allowlisting Give Salesforce, SOAP vendors, and payment gateways one dedicated IP pair to allowlist, wherever your code runs.](https://fixedmark.com/use-cases/partner-api-allowlisting)
- [Use case Bank and UPI APIs Whitelist one dedicated IP pair with your bank, UPI partner bank, or GSP, then deploy on Vercel or Railway without re-whitelisting.](https://fixedmark.com/use-cases/bank-and-upi-apis)
- [Integration AWS Lambda A fixed IP for Lambda without VPC, subnets, and two NAT Gateways.](https://fixedmark.com/integrations/aws-lambda)

## Frequently asked questions

### Is HTTPS traffic encrypted through an http\:// proxy?

Yes. For an \`https\://\` destination the client tunnels with CONNECT and runs TLS with the destination inside the tunnel, so the proxy and the network see only encrypted records. What is not encrypted is the CONNECT request and the \`Proxy-Authorization\` header, which carries your proxy credentials as base64.

### Does an https\:// proxy decrypt my traffic?

It decrypts only the outer TLS layer, which holds the CONNECT line and the proxy credentials. Your session with the destination runs inside the tunnel with keys the proxy does not have, unless the proxy presents its own certificate for the destination and your client trusts it.

### Should HTTPS_PROXY start with http\:// or https\://?

Either is valid. The variable selects the proxy for HTTPS destinations, and the value's own scheme decides how the client reaches the proxy. Use \`https\://\` when the proxy offers a TLS endpoint and your client supports it, because it encrypts the credentials.

### Can Java HttpClient use an HTTPS proxy?

No. \`java.net.http.HttpClient\` always connects to the proxy over plain TCP. Use a plain proxy port with a restricted credential, wrap the hop in TLS with a local forwarder, or move the call to a client that supports TLS to the proxy.

### Does TLS to the proxy slow requests down?

It adds one TLS handshake when a connection to the proxy opens. Reusing the client keeps the tunnel alive, so later requests on that connection pay no extra handshake.
