Skip to main content

Module url

Module url 

Source
Expand description

URL and origin normalization helpers.

This module contains product-neutral URL rules shared by Aster services. It normalizes HTTP origins for CORS and public-site matching, validates HTTP base URLs used by integrations, and exposes small predicates for OAuth-style redirect and endpoint checks. Callers still decide whether failures are configuration errors, validation errors, or domain-specific errors.

Structs§

HttpBaseUrlOptions
Options for normalize_http_base_url.

Functions§

has_http_scheme
Returns whether url uses http or https.
is_https_or_loopback_http
Returns whether url is HTTPS or an HTTP loopback URL.
join_origin_and_path
Joins an origin and an application path.
normalize_http_base_url
Normalizes an HTTP base URL.
normalize_origin
Normalizes an HTTP origin for CORS and public-site comparisons.
normalize_origin_with_additional_schemes
Normalizes an origin while accepting explicitly selected non-HTTP schemes.
normalize_public_site_origin
Normalizes a public site origin.
normalize_public_site_origins_config_value
Normalizes a public-site URL config value into canonical JSON.
parse_absolute_url
Parses an absolute URL and maps parser failures into UtilsError.
parse_http_url
Parses a required absolute HTTP or HTTPS URL with a host.
parse_public_site_origin_entries
Parses a JSON array of public site origins.
parse_public_site_origins
Parses, normalizes, and de-duplicates configured public site origins while preserving order.
parse_url
Parses a URL and maps parser failures into UtilsError.
public_site_origin_for_request
Selects the configured public-site origin that matches the current request, falling back to the first configured origin.
runtime_public_site_origins_with
Parses runtime public-site origins, ignoring invalid entries individually.