1

I am trying to connect to a WebDAV server through HAProxy. The goal is to direct all traffic through one port, 5443. My HAProxy server is bound to port 5443 with SSL.

I have tried connecting to WebDAV several different ways. I can connect directly locally via https://192.168.1.200:5006 and externally via https://webdav.domain.com:5006 if I open port 5006. When I try connecting through HAProxy with https://webdav.domain.com:5443 or http://webdav.domain.com:5080 I get an error saying "There was a problem connecting to the server 'webdav.domain.com'." The same thing happens when I try connecting over the LAN.

Is it possible to mount a WebDAV filesystem through HAProxy?

Below I have included my HAProxy configuration file.

global
    user haproxy
    daemon
    maxconn 256
    log localhost user info
    spread-checks 10
    tune.ssl.default-dh-param 2048

defaults
    mode http
    stats enable
    default-server inter 30s fastinter 5s
    log global
    option httplog
    timeout connect 5s
    timeout client 50s
    timeout server 50s
    timeout tunnel 1h

listen stats :8280
    stats uri /
    stats show-legends
    stats refresh 10s
    stats realm Haproxy\ Statistics
    stats auth admin:admin

frontend http
    bind :5080
    option http-server-close
    option forwardfor
    use_backend webdav_http if { hdr_beg(Host) -i webdav. }
    default_backend web

frontend https
    bind :5443 ssl crt /usr/local/haproxy/var/crt/default.pem ciphers AESGCM+AES128:AES128:AESGCM+AES256:AES256:RSA+RC4+SHA:!RSA+AES:!CAMELLIA:!aECDH:!3DES:!DSS:!PSK:!SRP:!aNULL no-sslv3
    option http-server-close
    option forwardfor
    rspirep ^Location:\ http://(.*)$    Location:\ https://\1
    rspadd Strict-Transport-Security:\ max-age=31536000;\ includeSubDomains
    use_backend webdav_https if { hdr_beg(Host) -i webdav. }
    use_backend haproxy if { hdr_beg(Host) -i haproxy. }
    default_backend web

backend web
    server web localhost:80 check

backend webdav_https
    server webdav_https localhost:5006 check

backend webdav_http
    server webdav_http localhost:5005 check

backend haproxy
    server haproxy localhost:8280 check

Relevant line(s) from HAProxy log

haproxy[10497]: 192.168.1.1:51676 [11/Sep/2015:18:16:56.659] https~ webdav/<NOSRV> 180/-1/-1/-1/180 503 212 - - SC-- 0/0/0/0/0 0/0 "OPTIONS / HTTP/1.1"
  • Can you post corresponding haproxy log lines? – Jim G. Sep 11 '15 at 21:13
  • @JimG. Only one line is logged when I try to access WebDAV. I've appended it to my post – DontTurnAround Sep 11 '15 at 22:17
  • Based off some reasearch [here](http://serverfault.com/questions/611272/haproxy-http-vs-tcp), I found that I might need to switch it from `http` mode to `tcp`. The only problem is now that `hdr_beg(Host)` doesn't work in TCP mode so the frontends are not mapping to the correct backends. – DontTurnAround Sep 11 '15 at 22:44

0 Answers0