0

I am running Hudson, Sonar and HA Proxy on the same server (Doing this for the sake of a POC so do not have access to multiple servers.

I am Using HAProxy to enable SSL for both servers.

I can access each of these servers locally using the following urls 127.0.0.1:9000/sonar and 127.0.0.1:8088/hudson from the host

But when I try to remotely access the server using https:/52.X.X.X/sonar or https:/52.X.X.X/hudson I get

No data received
ERR_EMPTY_RESPONSE

If I add a default_backend sonar to the HAProxy config i can run sonar but not hudson, and vice versa.

My HAProxy Config is like this

global
    log 127.0.0.1 local2
    tune.ssl.default-dh-param 2048

defaults
    mode tcp
    # Set timeouts to your needs
    timeout client  1h
    timeout connect 1h
    timeout server  1h
    option http-server-close

frontend http
    mode http
    bind *:80
    compression algo gzip
    redirect scheme https if !{ ssl_fc }

frontend https
    mode tcp
    bind *:443 ssl crt /etc/haproxy/buildserver.pem
    compression algo gzip

    use_backend sonar if { path_beg /sonar }
    use_backend hudson if { path_beg /hudson }

backend sonar
    server srv_sonar localhost:9000

backend hudson
    server srv_hudson localhost:8088

Any help on getting both sonar / hudson to run would be highly appreciated.

EDIT Final config file that works

global
    log 127.0.0.1 local2
    tune.ssl.default-dh-param 2048

defaults
    mode http
    # Set timeouts to your needs
    timeout client  1h
    timeout connect 1h
    timeout server  1h
    option http-server-close

frontend http
    bind *:80
    compression algo gzip
    redirect scheme https if !{ ssl_fc }

frontend https
    bind *:443 ssl crt /etc/haproxy/buildserver.pem
    compression algo gzip

    use_backend sonar if { path_beg /sonar }
    use_backend hudson if { path_beg /hudson }

backend sonar
    server srv_sonar localhost:9000

backend hudson
    server srv_hudson localhost:8088
remudada
  • 57
  • 8

1 Answers1

3

Your config is setup to use mode tcp for the frontend https block.

Change it to mode http and you should be fine.

The reason is that HAProxy isn't decoding your HTTP requests, but rather just looking at layer 4 information (source & destination IP and ports).

GregL
  • 9,030
  • 2
  • 24
  • 35