Skip to content

[haproxy-route] Match host header as domain, not as string  #245

@jsimpso

Description

@jsimpso

Enhancement Proposal

Hi,

I've integrated ingress-configurator with haproxy using the haproxy-route interface and the following configuration:

backend-addresses: 10.156.0.13
backend-ports: 80
hostname: test.example.com
paths: /development-jimm

This has given me the following HAProxy config:

frontend haproxy
    mode http
    bind [::]:80 v4v6
    bind [::]:443 v4v6 ssl crt /var/lib/haproxy/certs
    # Redirect HTTP to HTTPS
    http-request redirect scheme https unless { ssl_fc }

    acl acl_path_development-ingress-configurator path_beg -i /development-jimm
    acl acl_host_development-ingress-configurator req.hdr(Host) -m str test.example.com
    use_backend development-ingress-configurator if acl_path_development-ingress-configurator acl_host_development-ingress-configurator

    default_backend default


backend development-ingress-configurator
    balance leastconn
    timeout server 60s
    timeout connect 60s
    timeout queue 60s


    option httpchk
    http-check send hdr Host test.example.com
    server development-ingress-configurator_80_0 10.156.0.13:80

The workload this is connected to (jimm) exposes a Juju controller API. When I try to connect to it with the Juju CLI, host headers aren't sent by the Juju client and we see HAProxy logs indicating that the request falls through to the default backend:

haproxy~ default/<NOSRV> 0/-1/-1/-1/0 200 115 - - LR-- 1/1/0/0/0 0/0 "GET /development-jimm/api HTTP/1.1"

If I adjust the HAProxy use_backend configuration line to remove the acl_host_development-ingress-configurator directive, requests are correctly routed to the backend:

haproxy~ development-ingress-configurator/development-ingress-configurator_80_0 0/0/5/14/1029 101 2340 - - ---- 1/1/0/0/0 0/0 "GET /development-jimm/api HTTP/1.1"

Could we please update the possible configurations to allow for path-based routing without the requirement on host headers?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions