Home
Help
Search
Login
Register
OPNsense Forum
»
Archive
»
17.7 Legacy Series
»
HAProxy redirect root to www subdomain
« previous
next »
Print
Pages: [
1
]
Author
Topic: HAProxy redirect root to www subdomain (Read 5485 times)
Webxorcist
Newbie
Posts: 28
Karma: 2
HAProxy redirect root to www subdomain
«
on:
November 27, 2017, 01:26:05 pm »
I have several webservers behind HAProxy. I use the LetsEncrypt pluging that also redirects poort 80 to 443. I tried to redirect a domain.com to
www.domain.com
but I can't seem to get it working. Perhaps I am even thinking in the wrong direction.
What would be a decent way to configure this? I had my front-end also listen to domain.com as well as to
www.domain.com
and then an acl and action that put www. in front of the domain. But so far no go.
Also, would you need an ACL and action per domain or it is possible to do it all with one?
Logged
Webxorcist
Newbie
Posts: 28
Karma: 2
Re: HAProxy redirect root to www subdomain
«
Reply #1 on:
November 27, 2017, 03:52:47 pm »
Ok so you don't need an ACL. Just a listen in the frontend.
Apparently I came to the above conclusion to soon. It still isn't working.
«
Last Edit: November 27, 2017, 04:04:51 pm by Webxorcist
»
Logged
Webxorcist
Newbie
Posts: 28
Karma: 2
Re: HAProxy redirect root to www subdomain
«
Reply #2 on:
November 30, 2017, 03:29:38 pm »
1. Place this in your Frontend 'Option pass-through' with Advanced options turned on:
Code:
[Select]
redirect prefix http://www.yourdomain.eu code 301 if { hdr(host) -i yourdomain.eu }
2. Add the domain to the Listen addresses
3. If needed adjust the certificate to also support the domain without www
Logged
Print
Pages: [
1
]
« previous
next »
OPNsense Forum
»
Archive
»
17.7 Legacy Series
»
HAProxy redirect root to www subdomain