# 400 bad on https frontend to https backend

**URL:** <https://discourse.haproxy.org/t/400-bad-on-https-frontend-to-https-backend/10010>\
**Category:** Help!\
**Created:** [July 9, 2024, 9:12pm UTC](https://discourse.haproxy.org/t/400-bad-on-https-frontend-to-https-backend/10010 "2024-07-09T21:12:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![bittencourt.bnu](https://avatars.discourse-cdn.com/v4/letter/b/58f4c7/32.png) [@bittencourt.bnu](https://discourse.haproxy.org/u/bittencourt.bnu)\
**Post date:** [July 9, 2024, 9:12pm UTC](https://discourse.haproxy.org/t/400-bad-on-https-frontend-to-https-backend/10010/1 "2024-07-09T21:12:13Z")

</div>

Hello, I’m trying to set up a reverse proxy for an application that is running on HTTPS and does not accept http, only https and it cannot be changed. Using Haproxy, the redirection is always thrown to HTTP and not to HTTPS in the backend, causing a bad request 400. I’ve searched the internet and haven’t found a solution. The strange thing is that I can make it work on Squid Proxy.

NOTE: I’m using PFsense as a Proxy

My haproxy.cfg:

global  
maxconn 1000  
stats socket /tmp/haproxy.socket level admin expose-fd listeners  
uid 80  
gid 80  
nbthread 1  
hard-stop-after 15m  
chroot /tmp/haproxy\_chroot  
daemon  
server-state-file /tmp/haproxy\_server\_state

listen HAProxyLocalStats  
bind 127.0.0.1:2200 name localstats  
mode http  
stats enable  
stats admin if TRUE  
stats show-legends  
stats uri /haproxy/haproxy\_stats.php?haproxystats=1  
timeout client 5000  
timeout connect 5000  
timeout server 5000

frontend FrontEnd\_HTTPS  
bind 192.168.1.14:443 name 192.168.1.14:443 ssl crt-list /var/etc/haproxy/FrontEnd\_HTTPS.crt\_list  
mode http  
log global  
option http-keep-alive  
timeout client 30000  
acl acl\_zkbio var(txn.txnhost) -m str -i zkbio.teste.com.br  
acl aclcrt\_FrontEnd\_HTTPS var(txn.txnhost) -m reg -i ^zkbio.teste.com.br(:([0-9]){1,5})?$  
http-request set-var(txn.txnhost) hdr(host)  
use\_backend Backend\_ZKbio\_ipvANY if acl\_zkbio aclcrt\_FrontEnd\_HTTPS

backend Backend\_ZKbio\_ipvANY  
mode http  
id 100  
log global  
http-check send meth GET ver HTTP/1.1\r\nHost:\ 192.168.200.10:8098\r\nAccept:\ _/_  
timeout connect 30000  
timeout server 30000  
retries 3  
load-server-state-from-file global  
option httpchk  
server zkbio 192.168.200.10:8098 id 101 ssl check inter 1000 verify none

---

<div class="post-metadata">

**Author:** ![bittencourt.bnu](https://avatars.discourse-cdn.com/v4/letter/b/58f4c7/32.png) [@bittencourt.bnu](https://discourse.haproxy.org/u/bittencourt.bnu)\
**Post date:** [July 10, 2024, 1:52pm UTC](https://discourse.haproxy.org/t/400-bad-on-https-frontend-to-https-backend/10010/2 "2024-07-10T13:52:13Z")

</div>

I solved the problem by changing the frontend port from 443 to 8098 and creating a new frontend 443 redirecting requests to frontend 8098 which forwards to the backend https 8098, and it worked.
