# Assistance Needed for HAProxy as Forward Proxy for HTTPS APIs

**URL:** <https://discourse.haproxy.org/t/assistance-needed-for-haproxy-as-forward-proxy-for-https-apis/10255>\
**Category:** Help!\
**Created:** [September 20, 2024, 7:06am UTC](https://discourse.haproxy.org/t/assistance-needed-for-haproxy-as-forward-proxy-for-https-apis/10255 "2024-09-20T07:06:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![ankit.verma](https://avatars.discourse-cdn.com/v4/letter/a/ecccb3/32.png) [@ankit.verma](https://discourse.haproxy.org/u/ankit.verma)\
**Post date:** [September 20, 2024, 7:06am UTC](https://discourse.haproxy.org/t/assistance-needed-for-haproxy-as-forward-proxy-for-https-apis/10255/1 "2024-09-20T07:06:48Z")

</div>

Hello HAProxy Community,

I am trying to configure HAProxy to act as a forward proxy for both HTTP and HTTPS requests. My current configuration works fine when forwarding HTTP requests, but I’m encountering issues when trying to forward HTTPS requests. Below is my configuration:

```auto
config: |
  global
      log stdout format raw local0 debug
      chroot /var/lib/haproxy
      stats timeout 30s
      user haproxy
      group haproxy
      daemon
      maxconn 2000

  defaults
      log global
      mode http
      option httplog
      option dontlognull
      timeout connect 5000
      timeout client 50000
      timeout server 50000

  frontend http-in
      bind *:80
      bind *:443 ssl crt /etc/haproxy/certs/uat.domain.pem alpn h2,http/1.1
      mode http
      option httplog
      option forwardfor except 127.0.0.1
      redirect scheme https code 301 if !{ ssl_fc }
      default_backend https-backend

  backend https-backend
      mode http
      option httpchk GET /health
      server google google.com:443 ssl verify none

```

When I use curl to forward an HTTP request through HAProxy, it works fine:

```auto
$ curl -x https://haproxy.domain.com http://www.google.com -- this works fine

```

However, when forwarding an HTTPS request, I receive an error:

```auto
$ curl -x https://haproxy.domain.com https://www.google.com
curl: (56) Proxy CONNECT aborted

```

I suspect the issue is related to how HAProxy handles the CONNECT method for HTTPS forwarding, but I’m not entirely sure how to configure it correctly for HTTPS requests.

Could anyone help me identify what might be wrong with my configuration, or point me in the right direction on how to properly configure HAProxy as a forward proxy for HTTPS APIs?

Any guidance would be greatly appreciated!

Thank you!

---

<div class="post-metadata">

**Author:** ![lukastribus](https://avatars.discourse-cdn.com/v4/letter/l/7ea924/32.png) [@lukastribus](https://discourse.haproxy.org/u/lukastribus)\
**Post date:** [September 20, 2024, 9:10pm UTC](https://discourse.haproxy.org/t/assistance-needed-for-haproxy-as-forward-proxy-for-https-apis/10255/2 "2024-09-20T21:10:50Z")

</div>

Haproxy is a load-balancer and reverse proxy. It is not a forward proxy.

You may be able to get some forward proxying functionality to work, by fiddling around and sheer luck, but you will be on your own when things break, like in this case.
