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

# HAProxy route policy charm

[Platform Engineering](https://charmhub.io/publisher/platform-engineering-team "View all packages from Platform Engineering")

* [Platform Engineering](https://charmhub.io/publisher/platform-engineering-team "View all packages from Platform Engineering")

Platform:

24.04

edge 7497fd00

```
juju deploy haproxy-route-policy --channel edge
```

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

[Toggle side navigation](https://charmhub.io/haproxy-route-policy/libraries/haproxy_route_policy#drawer)

## charms.haproxy\_route\_policy.v0.haproxy\_route\_policy

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

    Fetch library

    ```
    charmcraft fetch-lib charms.haproxy_route_policy.v0.haproxy_route_policy
    ```

    [Download haproxy\_route\_policy.py](https://charmhub.io/haproxy-route-policy/libraries/haproxy_route_policy/download)
  + *Last updated* 22 Apr 2026
  + *Revision* Library version 0.8

haproxy-route-policy interface library.

This interface is used between the HAProxy charm (requirer) and the
haproxy-route-policy charm (provider).

The requirer publishes route policy requests under `backend_requests` as a list of
HAProxy backend objects. The provider publishes approved entries under
`approved_requests` and additionally exposes `policy_backend_port` and
provider unit addresses for policy web UI routing.

---

Index

* [def valid\_domain\_with\_wildcard(
  value
  )](https://charmhub.io/haproxy-route-policy/libraries/haproxy_route_policy#valid_domain_with_wildcard)
* [def valid\_domain(
  value
  )](https://charmhub.io/haproxy-route-policy/libraries/haproxy_route_policy#valid_domain)
* [class HaproxyRoutePolicyInvalidRelationDataError](https://charmhub.io/haproxy-route-policy/libraries/haproxy_route_policy#haproxyroutepolicyinvalidrelationdataerror)
* [class HaproxyRoutePolicyBackendRequest](https://charmhub.io/haproxy-route-policy/libraries/haproxy_route_policy#haproxyroutepolicybackendrequest)
* [class HaproxyRoutePolicyRequirerAppData](https://charmhub.io/haproxy-route-policy/libraries/haproxy_route_policy#haproxyroutepolicyrequirerappdata)
* + [def validate\_unique\_backend\_names(
    self)](https://charmhub.io/haproxy-route-policy/libraries/haproxy_route_policy#haproxyroutepolicyrequirerappdata-validate_unique_backend_names)
* [class HaproxyRoutePolicyProviderAppData](https://charmhub.io/haproxy-route-policy/libraries/haproxy_route_policy#haproxyroutepolicyproviderappdata)
* [class HaproxyRoutePolicyProvider](https://charmhub.io/haproxy-route-policy/libraries/haproxy_route_policy#haproxyroutepolicyprovider)
* + [def \_\_init\_\_(
    self,
    charm,
    relation\_name)](https://charmhub.io/haproxy-route-policy/libraries/haproxy_route_policy#haproxyroutepolicyprovider-__init__)
* + [def relation(
    self)](https://charmhub.io/haproxy-route-policy/libraries/haproxy_route_policy#haproxyroutepolicyprovider-relation)
* + [def set\_approved\_backend\_requests(
    self,
    approved\_requests,
    policy\_backend\_port)](https://charmhub.io/haproxy-route-policy/libraries/haproxy_route_policy#haproxyroutepolicyprovider-set_approved_backend_requests)
* [class HaproxyRoutePolicyRequirer](https://charmhub.io/haproxy-route-policy/libraries/haproxy_route_policy#haproxyroutepolicyrequirer)
* + [def \_\_init\_\_(
    self,
    charm,
    relation\_name)](https://charmhub.io/haproxy-route-policy/libraries/haproxy_route_policy#haproxyroutepolicyrequirer-__init__)
* + [def relation(
    self)](https://charmhub.io/haproxy-route-policy/libraries/haproxy_route_policy#haproxyroutepolicyrequirer-relation)
* + [def provide\_haproxy\_route\_policy\_requests(
    self,
    backend\_requests,
    proxied\_endpoint)](https://charmhub.io/haproxy-route-policy/libraries/haproxy_route_policy#haproxyroutepolicyrequirer-provide_haproxy_route_policy_requests)

#### 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 ).

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

Validate if value is a valid domain without wildcards.

#### class HaproxyRoutePolicyInvalidRelationDataError

Description

Raised when relation data validation for haproxy-route-policy fails. None

#### class HaproxyRoutePolicyBackendRequest

Data model representing a single backend request from the requirer.

Attributes

relation\_id

The relation ID of the request.

backend\_name

The name of the HAProxy backend.

hostname\_acls

List of hostname ACLs for the backend.

paths

List of paths for the backend.

port

Port number for the backend.

#### class HaproxyRoutePolicyRequirerAppData

Data model representing the requirer application data for haproxy-route-policy.

Attributes

backend\_requests

List of backend requests to be evaluated by the policy service.

Methods

HaproxyRoutePolicyRequirerAppData.
validate\_unique\_backend\_names(

*self*
)

Description

Ensure that backend names are unique across all requests. None

#### class HaproxyRoutePolicyProviderAppData

Description

haproxy-route-policy provider app databag schema. None

#### class HaproxyRoutePolicyProvider

Description

haproxy-route-policy provider implementation. None

Methods

HaproxyRoutePolicyProvider.
\_\_init\_\_(

*self*

,
charm: CharmBase

,
relation\_name: str
)

Initialize provider helper.

Arguments

charm

The charm instance using this helper.

relation\_name

Name of the relation endpoint.

HaproxyRoutePolicyProvider.
relation(

*self*
)

Description

Return the first relation for this endpoint, if any. None

HaproxyRoutePolicyProvider.
set\_approved\_backend\_requests(

*self*

,
approved\_requests

,
policy\_backend\_port: int
)

Description

Set and publish approved backend requests. None

#### class HaproxyRoutePolicyRequirer

Description

haproxy-route-policy requirer implementation. None

Methods

HaproxyRoutePolicyRequirer.
\_\_init\_\_(

*self*

,
charm: CharmBase

,
relation\_name: str
)

Initialize requirer helper.

Arguments

charm

The charm instance using this helper.

relation\_name

Name of the relation endpoint.

requests

Optional initial request backend list to publish.

HaproxyRoutePolicyRequirer.
relation(

*self*
)

Description

Return the first relation for this endpoint, if any. None

HaproxyRoutePolicyRequirer.
provide\_haproxy\_route\_policy\_requests(

*self*

,
backend\_requests

,
proxied\_endpoint
)

Description

Set and publish route policy requests. None
