Infinite loop when using haproxy

Hi there,

We are running ghost behind haproxy. Haproxy is used for terminating ssl and we are forwarding the request to ghost. The following is our haproxy config.

  log local0 notice
  maxconn 2048
  user haproxy
  group haproxy
  log     global
  mode    http
  option  httplog
  option  dontlognull
  retries 3
  option redispatch
  option forwardfor
  option http-server-close
  timeout connect  5000
  timeout client  10000
  timeout server  10000
backend ghost
  balance roundrobin
  option forwardfor
  http-request set-header X-Forwarded-Port %[dst_port]
  http-request add-header X-Forwarded-Proto https
  server ghost <ghost-ip>
frontend http-in
  bind :80
  bind :443 ssl crt <crt>
  use_backend ghost if { path_beg /blog }
  default_backend api

Our setup:

  • Ghost-CLI version: 1.11.0
  • Ghost version: 2.31.0

In ghost, our config url is https://<our-site>/blog.

This setup results in an infinite redirect to https://<our-site>/blog.

But it works when our config url is http://<our-site>/blog.

What is that we are missing out in haproxy config or is there something else that we are missing?