Getting the below message in haproxy log. could some one suggest me what went wrong.
a ‘http-request’ rule placed after a ‘redirect’ rule will still be processed before.
It is difficult to understand what real problem you have here, since you have duplicated configuration in back and frontends.
When you redirect HTTP to HTTPS, your backend server will not see any requests from the HTTP at all, haproxy will not even forward it, because it will send a redirect instead. So you will always see X-Forwarded-Proto: https on your backend server.
If possible can you please correct my config file if it is wrong and also you said it is duplicated
I am getting warning errors in my haproxy logs as below. Even though they say warning i am suspecting something wrong hence seeking help
Feb 09 13:24:38 haproxy-server systemd[1]: Started HAProxy Load Balancer.
Feb 9 13:24:38 haproxy-server haproxy[5006]: [WARNING] (5006) : config : parsing [/etc/haproxy/haproxy.cfg:42] : a ‘http-request’ rule placed after a ‘redirect’ rule will still be processed before.
Feb 9 13:24:38 haproxy-3-secondary haproxy[5006]: [WARNING] (5006) : config : parsing [/etc/haproxy/haproxy.cfg:43] : a ‘http-request’ rule placed after a ‘redirect’ rule will still be processed before.
In the non HTTP case, the headers you add are irrelevant, because only a redirect is created anyway, also, you need exactly 1 redirect statement, not 2 or 3.
However to make this more obvious and the configuration easier to read, I suggest separating the frontends, so you see immediately what is actually happening:
After doing the changes as you told warning messages are not comming and now I am not seeing haproxy logs over /var/log/haproxy.log or /var/log/syslog
I am using ubuntu22