HAproxy正在重定向到随机后端

时间:2018-12-20 10:33:00

标签: proxy haproxy

我是HAProxy的新手。我想做的基本上是为3个不同的事物提供3个不同的子域代理。

但是当我访问任何一个[[grafana.example.com, git.example.com, nextcloud.example.com]网址时,似乎都是在后端之间随机选择,而不是路由到正确的网址。

为什么会这样?

我的HAProxy.cfg:

    [gitlab]
    backend gitlab_backend
        redirect scheme https if !{ ssl_fc }
        server gitlab1 media.lan.example.com:4001 ssl check verify none
        mode http

    frontend gitlab_frontend_http
        bind git.example.com:80
        reqadd X-Forwarded-Proto:\ http
        use_backend gitlab_backend


    frontend gitlab_frontend_https
        bind git.example.com:443 ssl crt /certs/cert.pem
        reqadd X-Forwarded-Proto:\ https
        mode http
        use_backend gitlab_backend

    [grafana]
    backend grafana_backend
        redirect scheme https if !{ ssl_fc }
        server grafana1 monit.lan.example.com:3000 check
        mode http

    frontend grafana_frontend_http
        bind grafana.example.com:80
        reqadd X-Forwarded-Proto:\ http
        use_backend grafana_backend
        default_backend grafana_backend

    frontend grafana_frontend_https
        bind grafana.example.com:443 ssl crt /certs/cert.pem
        reqadd X-Forwarded-Proto:\ https
        mode http
        use_backend grafana_backend
        default_backend grafana_backend

    [nextcloud]
    backend nextcloud_backend
        redirect scheme https if !{ ssl_fc }
        server nextcloud1 media.lan.example.com:80 check
        mode http


    frontend nextcloud_frontend_http
        bind nextcloud.example.com:80
        reqadd X-Forwarded-Proto:\ http
        use_backend nextcloud_backend
        option httpclose


    frontend nextcloud_frontend_https
        bind nextcloud.example.com:443 ssl crt /certs/cert.pem
        reqadd X-Forwarded-Proto:\ https
        mode http
        use_backend nextcloud_backend
        option httpclose

0 个答案:

没有答案