Pfsense & HAProxy HTTPS

Hi all

Slight issue with my website.

I have pfsense running HAProxy serving my website on port 443… Certs are all fine etc but for some reason, you have to specifically put https:// in browser to access my site. Just putting the domain.co.uk doesn’t work.

I presume this is a setting somewhere in HA but I cant seem to find it!

Any help - greatly appreciated.
Thanks

Google “pfsense haproxy redirect http to https” lots of solutions out there.

Ahh I hadn’t realized I needed an HTTP frontend as well.

That cured it, thanks.

1 Like

How did that cure it? I am banging my head against the wall. No solution seems to make a difference for me.
HTTPS in the url works just fine, but redirection does not happen. At least, I think it is not happening. Hard to tell these days when browsers tend to do this for you. Using incognito modes or privacy browsers like duckduckgo will not redirect.

I created another frontend for http, using the same IP address but port 80 instead of 443

Edit HAProxy Frontend

External address

Listen address Custom address Port SSL Offloading Advanced Actions
192.168.10.10 80

Default backend, access control lists and actions

Access Control lists

Name Expression CS Not Value Actions
srv01 Host starts with: no no srv01.yourdomain.tld

Actions

Action Parameters Condition acl names Actions
http-request redirect See below srv01

rule: code 301 location https://%[hdr(host)]%[path]

I tried similar. I had no change. See me front end:

Any other ideas?

Oh man! So, I finally figured out the problem. You were correct from the beginning.

The problem had nothing to do with my setup. My ISP decided to up and block port 80 all of a sudden without telling me. I figured this out by going back to basics. I started up a simple webserver that listened to port 80 and just forwarded directly to that server. Worked on most every other port except 80. Spent 3 hours on the phone with my ISP to get this fixed.

All works now.

I really appreciate the help. I did learn a few things along the way, so not a total waste of time.

1 Like

how to redirect www to non www on same domain

Give them the same DNS entry and have a matching ACL in HAProxy.

I have ssl for example.com not for *.example.com and also one frontend:80 and frontend:443. I had to make ssl for wildcard as well or only A record www to domain. I want when someelse type www.example.com to redirert to https://www.example.com.

Then you would need the server that answers the request for www.example.com to send a redirect. Here is an exmaple:
How to redirect HTTP to HTTPS Using .htaccess

I got it to work: www.example.com to https://example.com but I can’t get to work with https://www.example.com. May be additional settings needed to Pfsense Haproxy,

Thanks in advance !!!