package documentation

Reverse proxy helper functions

All the functions in this module are meant to be used by the reverse proxy api and migration script. Be careful when using them in other contexts.

From __init__.py:

Function add_domain Add a new server to the nginx config.
Function add_path Add a new location to the _lan server.
Function certificate_list List all the certificates in the system.
Function create_location Create a new location in the nginx config.
Function set_proxy_pass Set the proxy pass for the specified location. This function is a mere workaround for nginx to allow non-resolvable domains to be used as proxy_pass.
def add_domain(domain, destination, certificate, description, allow): (source)

Add a new server to the nginx config.

Args:
  • domain: domain to answer to
  • destination: where to proxy the request to
  • certificate: certificate to be used, beware the certificate must be in the list of certificates
  • description: easy description of the server
  • allow: ip addresses allowed to access the server
def add_path(path, destination, description, allow): (source)

Add a new location to the _lan server.

Args:
  • path: path where the location will answer
  • destination: destination endpoint
  • description: description of the location
  • allow: array of allowed ip addresses
def certificate_list(uci: EUci): (source)

List all the certificates in the system.

Args:
  • uci: euci object
def create_location(e_uci, uci_server, location, proxy_pass, domain='', allow=None): (source)

Create a new location in the nginx config.

Args:
  • e_uci: EUci object
  • uci_server: where the location is defined
  • location: path where the location will answer
  • proxy_pass: where the location will proxy to
  • domain: optional domain to set in the Host header
  • allow: array of allowed ip addresses
Returns:
location id of the created location
def set_proxy_pass(e_uci, location, proxy_pass): (source)

Set the proxy pass for the specified location. This function is a mere workaround for nginx to allow non-resolvable domains to be used as proxy_pass.

Args:
  • e_uci: EUci object
  • location: nginx config location id
  • proxy_pass: string of the proxy pass to set