ProxyUrlConfig

data class ProxyUrlConfig(val baseUrl: String, val path: String = "", val additionalHeaders: Map<String, String> = emptyMap(), val strategy: ProxyStrategy = ProxyStrategy.HEADER_ORIGINAL_URL, val originalUrlHeaderName: String? = "X-Adswizz-Proxy-Original-URL", val originalUrlQueryParam: String? = "target_uri")

Configuration object that defines how a network request should be mapped to a proxy. The proxy behavior is determined by the selected strategy.

Parameters

baseUrl

The base URL of the publisher forward proxy (e.g., https://proxy.com).

  • Must be a valid absolute URL. SHOULD use HTTPS in production environments.

  • May include a custom port (e.g., https://proxy.com:8443).

path

Optional path appended to baseUrl to form the final proxy endpoint.

  • Defaults to an empty string. If provided, SHOULD begin with /.

Example:

baseUrl = "https://proxy.com"
path = "/adswizz/sdk-proxy/v1/forward"

Result:

https://proxy.com/adswizz/sdk-proxy/v1/forward
additionalHeaders

Optional headers appended to every proxied request.

  • Typically used for proxy authentication or routing metadata.

  • Values in this map override existing request headers with the same name.

strategy

Determines how the original destination URL is embedded into the proxied request.

originalUrlHeaderName

Header name that can be used by all strategies to transmit the original request URL.

Default value: "X-Adswizz-Proxy-Original-URL"

originalUrlQueryParam

The query parameter name used to embed the original request URL when using ProxyStrategy.QUERY_PARAM_ORIGINAL_URL.

Request URL becomes:

baseURL + path + ?target_uri=<urlEncoded(originalUrl)>

Ignored for other strategies.
When using ProxyStrategy.QUERY_PARAM_ORIGINAL_URL, this value MUST be non-empty; if it is empty or null, an exception will be raised.
Default value: "target_uri".

Validation Recommendations

Implementations SHOULD validate:

Changes to this configuration require SDK reinitialization.

Constructors

Link copied to clipboard
constructor(baseUrl: String, path: String = "", additionalHeaders: Map<String, String> = emptyMap(), strategy: ProxyStrategy = ProxyStrategy.HEADER_ORIGINAL_URL, originalUrlHeaderName: String? = "X-Adswizz-Proxy-Original-URL", originalUrlQueryParam: String? = "target_uri")

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard