Trying to figure out how a static page can be added to a haproxy.
I have a website: https://sky.example.com And i need to add addition static page https://sky.example.com/testing through Haproxy
My config file haproxy.cfg looks like this:
global
log /var/log loca2 err
chroot /var/lib/haproxy
user haproxy
group haproxy
daemon
tune.ssl.default-dh-param 1024
maxconn 8000de here
defaults
mode http
log global
balance static-rr
option httplog
timeout server 300s
timeout client 300s
timeout connect 5s
timeout queue 60s
retries 3
timeout http-request 60s
maxconn 8000
frontend skying
bind *:443 ssl crt /etc/haproxy/ssl/testing.pem
option forwardfor
acl modelx hdr(host) -i sky.example.com
use_backend missmay if modelx
acl is_info_testing path /testing
use_backend missmay if is_info_testing
backend missmay
mode http
errorfile 200 /etc/haproxy/static/testing.html
server test1_node1 192.168.1.25:78222 check cookie test1_node1
server test1_node2 192.168.1.26:78222 check cookie test1_node2
But it's not working. I get 404 error when I try to get the page https://sky.example.com/testing
What you are looking for is listen
and monitor-uri.
The following config, placed below defaults
, serves the static file 200.http on port 80:
listen static-file
bind :80
monitor-uri /
errorfile 200 /usr/local/etc/haproxy/errors/200.http
Content of 200.http could be:
HTTP/1.0 200 OK
Cache-Control: no-cache
Connection: close
Content-Type: text/html
<html><body><h1>200 we are good</h1>
Health checked.
</body></html>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With