Quantcast
Channel: HAProxy community - Latest topics
Viewing all articles
Browse latest Browse all 4757

Redirecting http to https is not working

$
0
0

@brijendrasial wrote:

My domain web.bullten.work points to 51.255.140.203. I have set haproxy as load balancer to this IP but when I request http://web.bullten.work it doesnt get redirected to https://web.bullten.work

Below is my config

[root@haproxy ~]# cat /etc/haproxy/haproxy.cfg

global
log 127.0.0.1:514 local0
log 127.0.0.1:514 local1 notice
maxconn 1024
user haproxy
group haproxy
daemon
tune.ssl.default-dh-param 2048

defaults
log global
mode http
option tcplog
option dontlognull
retries 3
option redispatch
maxconn 1024
timeout connect 5000ms
timeout client 50000ms
timeout server 50000ms

listen mariadb_cluster_writes
bind *:13304

A failover pool for writes to ensure writes only hit one node at a time.

    mode tcp
    option httpchk
    server galera-node01 192.168.1.1:3306 check port 9200
    server galera-node02 192.168.1.2:3306 check port 9200 backup
    server galera-node03 192.168.1.3:3306 check port 9200 backup

listen mariadb_cluster_reads
bind *:13305

A load-balanced pool for reads to utilize all nodes for reads.

    mode tcp
    balance leastconn
    option httpchk
    server galera-node01 192.168.1.1:3306 check port 9200
    server galera-node02 192.168.1.2:3306 check port 9200
    server galera-node03 192.168.1.3:3306 check port 9200

#---------------------------------------------------------------------

FrontEnd Configuration

#---------------------------------------------------------------------
frontend main
bind *:80
mode http
redirect scheme https code 301 if !{ ssl_fc }

# Test URI to see if its a letsencrypt request
acl letsencrypt-acl path_beg /.well-known/acme-challenge/
use_backend letsencrypt-backend if letsencrypt-acl

frontend main-https
bind *:443 ssl crt /etc/letsencrypt/live/web.bullten.work/web.bullten.work.pem alpn h2,http/1.1

default_backend app-main

LE Backend

backend letsencrypt-backend
server letsencrypt 127.0.0.1:8888

#---------------------------------------------------------------------

BackEnd roundrobin as balance algorithm

#---------------------------------------------------------------------
backend app-main
balance roundrobin #Balance algorithm
option httpchk HEAD / HTTP/1.1\r\nHost:\ localhost #Check the server application is up and healty - 200 status code
server nginx1 192.168.1.1:80 check #Nginx1
server nginx2 192.168.1.2:80 check #Nginx2
server nginx3 192.168.1.3:80 check #Nginx3

listen stats

HAProxy stats web gui.

    bind      :9000
    mode http
    stats enable
    stats uri /haproxy_stats
    stats realm HAProxy Statistics
    stats auth test:test
    stats admin if TRUE

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4757

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>