---
title: Charmhub | Deploy HAProxy using Charmhub - The Open Operator Collection
description: Deploy the latest version of HAProxy on any cloud.
url: https://charmhub.io/haproxy/libraries/haproxy_route
---

# HAProxy

[haproxy-team](https://charmhub.io/publisher/haproxy-team "View all packages from haproxy-team")

* [haproxy-team](https://charmhub.io/publisher/haproxy-team "View all packages from haproxy-team")
* [Networking](https://charmhub.io/?filter=networking)

Platform:

24.04

22.04

20.04

18.04

16.04

14.04

stable 147

```
juju deploy haproxy
```

[Learn to deploy on juju >](https://juju.is/docs/juju/manage-applications)

[Toggle side navigation](https://charmhub.io/haproxy/libraries/haproxy_route#drawer)

## charms.haproxy.v2.haproxy\_route

* [*Docstrings*Docstrings](https://charmhub.io/haproxy/libraries/haproxy_route)
  [*Code*Source code](https://charmhub.io/haproxy/libraries/haproxy_route/source-code)
* + Download

    Fetch library

    ```
    charmcraft fetch-lib charms.haproxy.v2.haproxy_route
    ```

    [Download haproxy\_route.py](https://charmhub.io/haproxy/libraries/haproxy_route/download)
  + *Last updated* 11 Sep 2026
  + *Revision* Library version 2.4

Haproxy-route interface library.

##### Getting Started

To get started using the library, you just need to fetch the library using `charmcraft`.

```
cd some-charm
charmcraft fetch-lib charms.haproxy.v2.haproxy_route
```

In the `metadata.yaml` of the charm, add the following:

```
requires:
    backend:
        interface: haproxy-route
        limit: 1
```

Then, to initialise the library:

```
from charms.haproxy.v2.haproxy_route import HaproxyRouteRequirer

class SomeCharm(CharmBase):
  def __init__(self, *args):
    # ...

    # There are 2 ways you can use the requirer implementation:
    # 1. To initialize the requirer with parameters:
    self.haproxy_route_requirer = HaproxyRouteRequirer(self,
        relation_name=<required>,
        service=<optional>,
        ports=<optional>,
        protocol=<optional>,
        hosts=<optional>,
        paths=<optional>,
        hostname=<optional>,
        additional_hostnames=<optional>,
        check_interval=<optional>,
        check_rise=<optional>,
        check_fall=<optional>,
        check_path=<optional>,
        check_port=<optional>,
        path_rewrite_expressions=<optional>, list of path rewrite expressions,
        query_rewrite_expressions=<optional>, list of query rewrite expressions,
        header_rewrite_expressions=<optional>, list of (header_name, rewrite_expression),
        load_balancing_algorithm=<optional>, defaults to "leastconn",
        load_balancing_cookie=<optional>, only used when load_balancing_algorithm is cookie
        load_balancing_consistent_hashing=<optional>, to enable consistent hashing,
            defaults to False,
        rate_limit_connections_per_minute=<optional>,
        rate_limit_policy=<optional>,
        upload_limit=<optional>,
        download_limit=<optional>,
        retry_count=<optional>,
        retry_redispatch=<optional>,
        deny_paths=<optional>,
        server_timeout=<optional>,
        connect_timeout=<optional>,
        queue_timeout=<optional>,
        server_maxconn=<optional>,
        unit_address=<optional>,
        http_server_close=<optional>,
    )

    # 2.To initialize the requirer with no parameters, i.e
    # self.haproxy_route_requirer = HaproxyRouteRequirer(self)
    # This will simply initialize the requirer class and it won't perfom any action.

    # Afterwards regardless of how you initialized the requirer you can call the
    # provide_haproxy_route_requirements method anywhere in your charm to update the requirer data.
    # The method takes the same number of parameters as the requirer class.
    # provide_haproxy_route_requirements(address=, port=, ...)

    self.framework.observe(
        self.framework.on.config_changed, self._on_config_changed
    )
    self.framework.observe(
        self.haproxy_route_requirer.on.ready, self._on_endpoints_ready
    )
    self.framework.observe(
        self.haproxy_route_requirer.on.removed, self._on_endpoints_removed
    )

    def _on_config_changed(self, event: ConfigChangedEvent) -> None:
        self.haproxy_route_requirer.provide_haproxy_route_requirements(...)

    def _on_endpoints_ready(self, _: EventBase) -> None:
        # Handle endpoints ready event
        ...

    def _on_endpoints_removed(self, _: EventBase) -> None:
        # Handle endpoints removed event
        ...

## Using the library as the provider
The provider charm should expose the interface as shown below:
```yaml
provides:
    haproxy-route:
        interface: haproxy-route
```

Note that this interface supports relating to multiple endpoints.

Then, to initialise the library:

```
from charms.haproxy.v2.haproxy_route import HaproxyRouteProvider

class SomeCharm(CharmBase):
    self.haproxy_route_provider = HaproxyRouteProvider(self)
    self.framework.observe(
        self.haproxy_route_provider.on.data_available, self._on_haproxy_route_data_available
    )

    def _on_haproxy_route_data_available(self, event: EventBase) -> None:
        data = self.haproxy_route_provider.get_data(self.haproxy_route_provider.relations)
        ...
```

---

Index

* [def value\_contains\_invalid\_characters(
  invalid\_characters,
  value
  )](https://charmhub.io/haproxy/libraries/haproxy_route#value_contains_invalid_characters)
* [def valid\_domain\_with\_wildcard(
  value
  )](https://charmhub.io/haproxy/libraries/haproxy_route#valid_domain_with_wildcard)
* [class DataValidationError](https://charmhub.io/haproxy/libraries/haproxy_route#datavalidationerror)
* [class HaproxyRouteInvalidRelationDataError](https://charmhub.io/haproxy/libraries/haproxy_route#haproxyrouteinvalidrelationdataerror)
* [class ServerHealthCheck](https://charmhub.io/haproxy/libraries/haproxy_route#serverhealthcheck)
* + [def check\_all\_required\_fields\_set(
    self)](https://charmhub.io/haproxy/libraries/haproxy_route#serverhealthcheck-check_all_required_fields_set)
* [class RateLimitPolicy](https://charmhub.io/haproxy/libraries/haproxy_route#ratelimitpolicy)
* [class RateLimit](https://charmhub.io/haproxy/libraries/haproxy_route#ratelimit)
* [class LoadBalancingAlgorithm](https://charmhub.io/haproxy/libraries/haproxy_route#loadbalancingalgorithm)
* [class LoadBalancingConfiguration](https://charmhub.io/haproxy/libraries/haproxy_route#loadbalancingconfiguration)
* + [def validate\_attributes(
    self)](https://charmhub.io/haproxy/libraries/haproxy_route#loadbalancingconfiguration-validate_attributes)
* [class BandwidthLimit](https://charmhub.io/haproxy/libraries/haproxy_route#bandwidthlimit)
* [class Retry](https://charmhub.io/haproxy/libraries/haproxy_route#retry)
* [class TimeoutConfiguration](https://charmhub.io/haproxy/libraries/haproxy_route#timeoutconfiguration)
* [class HaproxyRewriteMethod](https://charmhub.io/haproxy/libraries/haproxy_route#haproxyrewritemethod)
* [class RewriteConfiguration](https://charmhub.io/haproxy/libraries/haproxy_route#rewriteconfiguration)
* [class RequirerApplicationData](https://charmhub.io/haproxy/libraries/haproxy_route#requirerapplicationdata)
* + [def validate\_load\_balancing\_configuration(
    cls,
    configuration)](https://charmhub.io/haproxy/libraries/haproxy_route#requirerapplicationdata-validate_load_balancing_configuration)
* + [def validate\_rewrites(
    cls,
    rewrites)](https://charmhub.io/haproxy/libraries/haproxy_route#requirerapplicationdata-validate_rewrites)
* [class HaproxyRouteProviderAppData](https://charmhub.io/haproxy/libraries/haproxy_route#haproxyrouteproviderappdata)
* [class RequirerUnitData](https://charmhub.io/haproxy/libraries/haproxy_route#requirerunitdata)
* [class HaproxyRouteRequirerData](https://charmhub.io/haproxy/libraries/haproxy_route#haproxyrouterequirerdata)
* [class HaproxyRouteRequirersData](https://charmhub.io/haproxy/libraries/haproxy_route#haproxyrouterequirersdata)
* + [def check\_services\_unique(
    self)](https://charmhub.io/haproxy/libraries/haproxy_route#haproxyrouterequirersdata-check_services_unique)
* + [def check\_external\_grpc\_port\_unique(
    self)](https://charmhub.io/haproxy/libraries/haproxy_route#haproxyrouterequirersdata-check_external_grpc_port_unique)
* + [def check\_grpc\_requires\_https(
    self)](https://charmhub.io/haproxy/libraries/haproxy_route#haproxyrouterequirersdata-check_grpc_requires_https)
* [class HaproxyRouteDataAvailableEvent](https://charmhub.io/haproxy/libraries/haproxy_route#haproxyroutedataavailableevent)
* [class HaproxyRouteDataRemovedEvent](https://charmhub.io/haproxy/libraries/haproxy_route#haproxyroutedataremovedevent)
* [class HaproxyRouteProviderEvents](https://charmhub.io/haproxy/libraries/haproxy_route#haproxyrouteproviderevents)
* [class HaproxyRouteProvider](https://charmhub.io/haproxy/libraries/haproxy_route#haproxyrouteprovider)
* + [def \_\_init\_\_(
    self,
    charm,
    relation\_name,
    raise\_on\_validation\_error)](https://charmhub.io/haproxy/libraries/haproxy_route#haproxyrouteprovider-__init__)
* + [def relations(
    self)](https://charmhub.io/haproxy/libraries/haproxy_route#haproxyrouteprovider-relations)
* + [def get\_data(
    self,
    relations)](https://charmhub.io/haproxy/libraries/haproxy_route#haproxyrouteprovider-get_data)
* + [def publish\_proxied\_endpoints(
    self,
    endpoints,
    relation)](https://charmhub.io/haproxy/libraries/haproxy_route#haproxyrouteprovider-publish_proxied_endpoints)
* [class HaproxyRouteEnpointsReadyEvent](https://charmhub.io/haproxy/libraries/haproxy_route#haproxyrouteenpointsreadyevent)
* [class HaproxyRouteEndpointsRemovedEvent](https://charmhub.io/haproxy/libraries/haproxy_route#haproxyrouteendpointsremovedevent)
* [class HaproxyRouteRequirerEvents](https://charmhub.io/haproxy/libraries/haproxy_route#haproxyrouterequirerevents)
* [class HaproxyRouteRequirer](https://charmhub.io/haproxy/libraries/haproxy_route#haproxyrouterequirer)
* + [def \_\_init\_\_(
    self,
    charm,
    relation\_name,
    service,
    ports,
    protocol,
    hosts,
    paths,
    hostname,
    additional\_hostnames,
    check\_interval,
    check\_rise,
    check\_fall,
    check\_path,
    check\_port,
    path\_rewrite\_expressions,
    query\_rewrite\_expressions,
    header\_rewrite\_expressions,
    load\_balancing\_algorithm,
    load\_balancing\_cookie,
    load\_balancing\_consistent\_hashing,
    rate\_limit\_connections\_per\_minute,
    rate\_limit\_policy,
    upload\_limit,
    download\_limit,
    retry\_count,
    retry\_redispatch,
    deny\_paths,
    server\_timeout,
    connect\_timeout,
    queue\_timeout,
    server\_maxconn,
    unit\_address,
    http\_server\_close,
    allow\_http)](https://charmhub.io/haproxy/libraries/haproxy_route#haproxyrouterequirer-__init__)
* + [def provide\_haproxy\_route\_requirements(
    self,
    service,
    ports,
    protocol,
    hosts,
    paths,
    hostname,
    additional\_hostnames,
    check\_interval,
    check\_rise,
    check\_fall,
    check\_path,
    check\_port,
    path\_rewrite\_expressions,
    query\_rewrite\_expressions,
    header\_rewrite\_expressions,
    load\_balancing\_algorithm,
    load\_balancing\_cookie,
    load\_balancing\_consistent\_hashing,
    rate\_limit\_connections\_per\_minute,
    rate\_limit\_policy,
    upload\_limit,
    download\_limit,
    retry\_count,
    retry\_redispatch,
    deny\_paths,
    server\_timeout,
    connect\_timeout,
    queue\_timeout,
    server\_maxconn,
    unit\_address,
    http\_server\_close,
    allow\_http,
    external\_grpc\_port)](https://charmhub.io/haproxy/libraries/haproxy_route#haproxyrouterequirer-provide_haproxy_route_requirements)
* + [def update\_relation\_data(
    self)](https://charmhub.io/haproxy/libraries/haproxy_route#haproxyrouterequirer-update_relation_data)
* + [def get\_proxied\_endpoints(
    self)](https://charmhub.io/haproxy/libraries/haproxy_route#haproxyrouterequirer-get_proxied_endpoints)

#### def value\_contains\_invalid\_characters(     invalid\_characters: str,     value )

Validate if value contains invalid config characters.

Arguments

invalid\_characters

String with the list of invalid characters.

value

The value to validate.

Returns

The validated value.

#### def valid\_domain\_with\_wildcard(value: str)

Validate if value is a valid domain that can include a wildcard.

Arguments

value

The value to validate.

Description

The wildcard character (\*) can't be at the TLD level, for example \*.com is not valid.
This is supported natively by the library ( e.g domain("com") will raise a ValidationError ).

#### class DataValidationError

Description

Raised when data validation fails. None

#### class HaproxyRouteInvalidRelationDataError

Description

Rasied when data validation of the haproxy-route relation fails. None

#### class ServerHealthCheck

Configuration model for backend server health checks.

Attributes

interval

Number of seconds between consecutive health check attempts.

rise

Number of consecutive successful health checks required for up.

fall

Number of consecutive failed health checks required for DOWN.

path

List of URL paths to use for HTTP health checks.

port

Customize port value for http-check.

Methods

ServerHealthCheck.
check\_all\_required\_fields\_set(

*self*
)

Check that all required fields for health check are set.

Returns

The validated model.

#### class RateLimitPolicy

Enum of possible rate limiting policies.

Description

Attrs:
DENY: deny a client's HTTP request to return a 403 Forbidden error.
REJECT: closes the connection immediately without sending a response.
SILENT: disconnects immediately without notifying the client
that the connection has been closed.

#### class RateLimit

Configuration model for connection rate limiting.

Attributes

connections\_per\_minute

Number of connections allowed per minute for a client.

policy

Action to take when the rate limit is exceeded.

#### class LoadBalancingAlgorithm

Enum of possible http\_route types.

Description

Attrs:
LEASTCONN: The server with the lowest number of connections receives the connection.
SRCIP: Load balance using the hash of The source IP address.
ROUNDROBIN: Each server is used in turns, according to their weights.
COOKIE: Load balance using hash req.cookie(clientid).

#### class LoadBalancingConfiguration

Configuration model for load balancing.

Attributes

algorithm

Algorithm to use for load balancing.

cookie

Cookie name to use when algorithm is set to cookie.

consistent\_hashing

Use consistent hashing to avoid redirection
when servers are added/removed.

Methods

LoadBalancingConfiguration.
validate\_attributes(

*self*
)

Check that algorithm-specific configs are only set with their respective algorithm.

Returns

The validated model.

#### class BandwidthLimit

Configuration model for bandwidth rate limiting.

Attributes

upload

Limit upload speed (bytes per second).

download

Limit download speed (bytes per second).

#### class Retry

Configuration model for retry.

Attributes

count

How many times should a request retry.

redispatch

Whether to redispatch failed requests to another server.

#### class TimeoutConfiguration

Configuration model for timeout.

Attributes

server

Timeout for requests from haproxy to backend servers.

connect

Timeout for client requests to haproxy.

queue

Timeout for requests waiting in the queue after server-maxconn is reached.

#### class HaproxyRewriteMethod

Enum of possible HTTP rewrite methods.

Description

Attrs:
SET\_PATH: The server with the lowest number of connections receives the connection.
SET\_QUERY: Load balance using the hash of The source IP address.
SET\_HEADER: Each server is used in turns, according to their weights.

#### class RewriteConfiguration

Configuration model for HTTP rewrite.

Attributes

method

Which rewrite method to apply.One of set-path, set-query, set-header.

expression

Regular expression to use with the rewrite method.

header

The name of the header to rewrited.

#### class RequirerApplicationData

Configuration model for HAProxy route requirer application data.

Attributes

service

Name of the service requesting HAProxy routing.

ports

List of port numbers on which the service is listening.

protocol

The protocol that the service speaks.

hosts

List of backend server addresses.

paths

List of URL paths to route to this service. Defaults to an empty list.

hostname

Optional: The hostname of this service.

additional\_hostnames

List of additional hostnames of this service.
Defaults to an empty list.

rewrites

List of RewriteConfiguration objects defining path, query, or header
rewrite rules.

check

ServerHealthCheck configuration for monitoring backend health.

load\_balancing

Configuration for the load balancing strategy.

rate\_limit

Optional configuration for limiting connection rates.

bandwidth\_limit

Optional configuration for limiting upload and download bandwidth.

retry

Optional configuration for request retry behavior.

deny\_paths

List of URL paths that should not be routed to the backend.

timeout

Configuration for server, client, and queue timeouts.

server\_maxconn

Optional maximum number of connections per server.

http\_server\_close

Configure server close after request.

allow\_http

Whether to allow HTTP traffic in addition to HTTPS. Defaults to False.
Warning: enabling HTTP is a security risk, make sure you apply the necessary precautions.

external\_grpc\_port

Optional external gRPC port.

Methods

RequirerApplicationData.
validate\_load\_balancing\_configuration(

cls

,
configuration: LoadBalancingConfiguration
)

Validate the parsed load balancing configuration.

Arguments

configuration

The configuration to validate.

Returns

LoadBalancingConfiguration

The validated configuration.

RequirerApplicationData.
validate\_rewrites(

cls

,
rewrites
)

Validate the parsed list of rewrite configurations.

Arguments

rewrites

The configurations to validate.

Returns

list[RewriteConfiguration]

The validated configurations.

#### class HaproxyRouteProviderAppData

haproxy-route provider databag schema.

Attributes

endpoints

The list of proxied endpoints that maps to the backend.

#### class RequirerUnitData

haproxy-route requirer unit data.

Attributes

address

IP address of the unit.

#### class HaproxyRouteRequirerData

haproxy-route requirer data.

Attributes

relation\_id

Id of the relation.

application\_data

Application data.

units\_data

Units data

#### class HaproxyRouteRequirersData

haproxy-route requirers data.

Attributes

requirers\_data

List of requirer data.

relation\_ids\_with\_invalid\_data

Set of relation ids that contains invalid data.

Methods

HaproxyRouteRequirersData.
check\_services\_unique(

*self*
)

Returns

The validated model.

Description

Check that requirers define unique services. If multiple requirers declare the same service name,
their relation ids are added to relation\_ids\_with\_invalid\_data.

HaproxyRouteRequirersData.
check\_external\_grpc\_port\_unique(

*self*
)

Returns

The validated model.

Description

Check that external gRPC ports are unique across requirer applications. If multiple requirer applications declare the same external gRPC port,
their relation ids are added to relation\_ids\_with\_invalid\_data.

HaproxyRouteRequirersData.
check\_grpc\_requires\_https(

*self*
)

Returns

Self

The validated model

Description

Check that backends with external\_grpc\_port use https protocol. If not, their relation ids are added to relation\_ids\_with\_invalid\_data.

#### class HaproxyRouteDataAvailableEvent

HaproxyRouteDataAvailableEvent custom event.

Description

This event indicates that the requirers data are available.

#### class HaproxyRouteDataRemovedEvent

HaproxyRouteDataRemovedEvent custom event.

Description

This event indicates that one of the endpoints was removed.

#### class HaproxyRouteProviderEvents

List of events that the TLS Certificates requirer charm can leverage.

Attributes

data\_available

This event indicates that
the haproxy-route endpoints are available.

data\_removed

This event indicates that one of the endpoints was removed.

#### class HaproxyRouteProvider

Haproxy-route interface provider implementation.

Attributes

on

Custom events of the provider.

relations

Related appliations.

Methods

HaproxyRouteProvider.
\_\_init\_\_(

*self*

,
charm: CharmBase

,
relation\_name: str

,
raise\_on\_validation\_error: bool
)

Initialize the HaproxyRouteProvider.

Arguments

charm

The charm that is instantiating the library.

relation\_name

The name of the relation.

raise\_on\_validation\_error

Whether the library should raise
HaproxyRouteInvalidRelationDataError when requirer data validation fails.
If this is set to True the provider charm needs to also catch and handle the
thrown exception.

HaproxyRouteProvider.
relations(

*self*
)

Description

The list of Relation instances associated with this endpoint. None

HaproxyRouteProvider.
get\_data(

*self*

,
relations
)

Fetch requirer data.

Arguments

relations

A list of Relation instances to fetch data from.

Returns

HaproxyRouteRequirersData

Validated data from all haproxy-route requirers.

HaproxyRouteProvider.
publish\_proxied\_endpoints(

*self*

,
endpoints

,
relation: Relation
)

Publish to the app databag the proxied endpoints.

Arguments

endpoints

The list of proxied endpoints to publish.

relation

The relation with the requirer application.

#### class HaproxyRouteEnpointsReadyEvent

Description

HaproxyRouteEnpointsReadyEvent custom event. None

#### class HaproxyRouteEndpointsRemovedEvent

Description

HaproxyRouteEndpointsRemovedEvent custom event. None

#### class HaproxyRouteRequirerEvents

List of events that the TLS Certificates requirer charm can leverage.

Attributes

ready

when the provider proxied endpoints are ready.

removed

when the provider

#### class HaproxyRouteRequirer

haproxy-route interface requirer implementation.

Attributes

on

Custom events of the requirer.

Methods

HaproxyRouteRequirer.
\_\_init\_\_(

*self*

,
charm: CharmBase

,
relation\_name: str

,
service

,
ports

,
protocol

,
hosts

,
paths

,
hostname

,
additional\_hostnames

,
check\_interval

,
check\_rise

,
check\_fall

,
check\_path

,
check\_port

,
path\_rewrite\_expressions

,
query\_rewrite\_expressions

,
header\_rewrite\_expressions

,
load\_balancing\_algorithm: LoadBalancingAlgorithm

,
load\_balancing\_cookie

,
load\_balancing\_consistent\_hashing: bool

,
rate\_limit\_connections\_per\_minute

,
rate\_limit\_policy: RateLimitPolicy

,
upload\_limit

,
download\_limit

,
retry\_count

,
retry\_redispatch: bool

,
deny\_paths

,
server\_timeout: int

,
connect\_timeout: int

,
queue\_timeout: int

,
server\_maxconn

,
unit\_address

,
http\_server\_close: bool

,
allow\_http: bool
)

Initialize the HaproxyRouteRequirer.

Arguments

charm

The charm that is instantiating the library.

relation\_name

The name of the relation to bind to.

service

The name of the service to route traffic to.

ports

List of ports the service is listening on.

protocol

The protocol that the service speaks.

hosts

List of backend server addresses. Currently only support IP addresses.

paths

List of URL paths to route to this service.

hostname

Hostname of this service.

additional\_hostnames

Additional hostnames of this service.

check\_interval

Interval between health checks in seconds.

check\_rise

Number of successful health checks before server is considered up.

check\_fall

Number of failed health checks before server is considered down.

check\_path

The path to use for server health checks.

check\_port

The port to use for http-check.

path\_rewrite\_expressions

List of regex expressions for path rewrites.

query\_rewrite\_expressions

List of regex expressions for query rewrites.

header\_rewrite\_expressions

List of tuples containing header name
and rewrite expression.

load\_balancing\_algorithm

Algorithm to use for load balancing.

load\_balancing\_cookie

Cookie name to use when algorithm is set to cookie.

load\_balancing\_consistent\_hashing

Whether to use consistent hashing.

rate\_limit\_connections\_per\_minute

Maximum connections allowed per minute.

rate\_limit\_policy

Policy to apply when rate limit is reached.

upload\_limit

Maximum upload bandwidth in bytes per second.

download\_limit

Maximum download bandwidth in bytes per second.

retry\_count

Number of times to retry failed requests.

retry\_redispatch

Whether to redispatch failed requests to another server.

deny\_paths

List of paths that should not be routed to the backend.

server\_timeout

Timeout for requests from haproxy to backend servers in seconds.

connect\_timeout

Timeout for client requests to haproxy in seconds.

queue\_timeout

Timeout for requests waiting in queue in seconds.

server\_maxconn

Maximum connections per server.

unit\_address

IP address of the unit (if not provided, will use binding address).

http\_server\_close

Configure server close after request.

allow\_http

Whether to allow HTTP traffic in addition to HTTPS.
Warning: enabling HTTP is a security risk,
make sure you apply the necessary precautions.

HaproxyRouteRequirer.
provide\_haproxy\_route\_requirements(

*self*

,
service: str

,
ports

,
protocol

,
hosts

,
paths

,
hostname

,
additional\_hostnames

,
check\_interval

,
check\_rise

,
check\_fall

,
check\_path

,
check\_port

,
path\_rewrite\_expressions

,
query\_rewrite\_expressions

,
header\_rewrite\_expressions

,
load\_balancing\_algorithm: LoadBalancingAlgorithm

,
load\_balancing\_cookie

,
load\_balancing\_consistent\_hashing: bool

,
rate\_limit\_connections\_per\_minute

,
rate\_limit\_policy: RateLimitPolicy

,
upload\_limit

,
download\_limit

,
retry\_count

,
retry\_redispatch: bool

,
deny\_paths

,
server\_timeout: int

,
connect\_timeout: int

,
queue\_timeout: int

,
server\_maxconn

,
unit\_address

,
http\_server\_close: bool

,
allow\_http: bool

,
external\_grpc\_port
)

Update haproxy-route requirements data in the relation.

Arguments

service

The name of the service to route traffic to.

ports

List of ports the service is listening on.

protocol

The protocol that the serive speaks, deafults to "http".

hosts

List of backend server addresses. Currently only support IP addresses.

paths

List of URL paths to route to this service.

hostname

Hostname of this service.

additional\_hostnames

Additional hostnames of this service.

check\_interval

Interval between health checks in seconds.

check\_rise

Number of successful health checks before server is considered up.

check\_fall

Number of failed health checks before server is considered down.

check\_path

The path to use for server health checks.

check\_port

The port to use for http-check.

path\_rewrite\_expressions

List of regex expressions for path rewrites.

query\_rewrite\_expressions

List of regex expressions for query rewrites.

header\_rewrite\_expressions

List of tuples containing header name
and rewrite expression.

load\_balancing\_algorithm

Algorithm to use for load balancing.

load\_balancing\_cookie

Cookie name to use when algorithm is set to cookie.

load\_balancing\_consistent\_hashing

Whether to use consistent hashing.

rate\_limit\_connections\_per\_minute

Maximum connections allowed per minute.

rate\_limit\_policy

Policy to apply when rate limit is reached.

upload\_limit

Maximum upload bandwidth in bytes per second.

download\_limit

Maximum download bandwidth in bytes per second.

retry\_count

Number of times to retry failed requests.

retry\_redispatch

Whether to redispatch failed requests to another server.

deny\_paths

List of paths that should not be routed to the backend.

server\_timeout

Timeout for requests from haproxy to backend servers in seconds.

connect\_timeout

Timeout for client requests to haproxy in seconds.

queue\_timeout

Timeout for requests waiting in queue in seconds.

server\_maxconn

Maximum connections per server.

unit\_address

IP address of the unit (if not provided, will use binding address).

http\_server\_close

Configure server close after request.

allow\_http

Whether to allow HTTP traffic in addition to HTTPS.
Warning: enabling HTTP is a security risk,
make sure you apply the necessary precautions.

external\_grpc\_port

Optional external gRPC port.

HaproxyRouteRequirer.
update\_relation\_data(

*self*
)

Description

Update both application and unit data in the relation. None

HaproxyRouteRequirer.
get\_proxied\_endpoints(

*self*
)

The full ingress URL to reach the current unit.

Returns

The provider URL or None if the URL isn't available yet or is not valid.
