setReverseProxy

open fun setReverseProxy(url: String)

See also


open fun setReverseProxy(url: String, headers: Map<String, String>)

Routes all SDK network requests through the specified reverse proxy URL and sets custom HTTP headers for all requests. Settings are not persisted and must be set on every app start.

Requirescom.pushwoosh.allow_reverse_proxy meta-data set to true in AndroidManifest.xml:


  <meta-data android:name="com.pushwoosh.allow_reverse_proxy" android:value="true" />

Important: This method must be called in Application.onCreate(), not in Activity.onCreate(). The SDK initializes automatically via ContentProvider before your Application class is created. Calling this method in Application.onCreate() guarantees that the reverse proxy URL is set before any SDK network requests are sent.


  // Enable reverse proxy with custom headers
  Map<String, String> headers = new HashMap<>();
  headers.put("X-Proxy-Auth", "my-token");
  Pushwoosh.getInstance().setReverseProxy("https://your-proxy.example.com/json/1.3/", headers);

Parameters

url

the reverse proxy URL (must be a valid https:// or http:// URL)

headers

optional map of custom HTTP headers (may be null)