After editing my haproxy config. All my subdomains are now redirecting to https. I just want my domain.com to redirect to https not my subdomains. How do I stop this? Below is my redirect script.
UPDATED
global
log /dev/log local0
log /dev/log local1 notice
chroot /var/lib/haproxy
user haproxy
group haproxy
daemon
ca-base /ssl
crt-base /ssl
ssl-default-bind-ciphers kEECDH+aRSA+AES:kRSA+AES:+AES256:RC4-SHA:!kEDH:!LOW:!EXP:!MD5:!aNULL:!eNULL
defaults
log global
mode http
option httplog
option redispatch
option forwardfor
option dontlognull
option http-server-close
timeout connect 5s
timeout client 30s
timeout server 30s
timeout tunnel 1h
frontend public-front
bind *:80
redirect scheme https if !{ ssl_fc }
bind *:443 ssl crt domain.com.pem
use_backend some-back if { path_beg /somepath/ }
default_backend default-back
backend some-back
reqadd X-Forwarded-Proto:\ https
balance leastconn
option httpchk GET /somepath
timeout check 500ms
server some-back someback.domain.com:443 check-ssl ssl ca-file domain.com.pem inter 500ms
backend default-back
reqadd X-Forwarded-Proto:\ https
balance leastconn
option httpchk GET
timeout check 500ms
server default-back 127.0.0.1:8080 check-ssl ssl ca-file domain.com.pem inter 500ms
frontend stats-front
bind :8888 ssl crt domain.com.pem
default_backend stats-back
backend stats-back
stats enable
stats hide-version
stats realm Haproxy\ Statistics
stats uri /statistics
stats auth admin:password
I use https://domain.com as my homepage, naked or no www, this points to haproxy
I use http://sub.domain.com for other things but this redirects to https after accessing the homepage.
HA-Proxy version 1.5.4 2014/09/02
Remove
redirect scheme https if !{ ssl_fc }
from your "public-front" frontend and replace it with:Should do what you want. These URLs would redirect:
These wouldn't: