Skip to content

How do I add custom headers for all the network calls made by the AWS Device

0

We are using AWS Device Farm private devices and want to route all outbound traffic through a proxy in our VPC. This proxy will intercept HTTPS traffic to log API calls and inject custom headers during test runs. How do I achieve this ?

2 Answers
5

Take this:

  1. Use VPC-ENI Connectivity Configure your Device Farm project to use VPC Elastic Network Interface (ENI) connectivity. This allows test hosts and private devices to route traffic through your VPC.
  2. Deploy a Transparent HTTPS Proxy Set up a proxy (e.g., Squid, mitmproxy, or Envoy) in your VPC that: o Intercepts HTTPS traffic o Logs requests o Injects custom headers
  3. Configure Proxy Settings on Devices Use Device Farm instance profiles to configure proxy settings on the test host or device. This can include: o Setting environment variables (HTTPS_PROXY) o Modifying system proxy settings (for rooted Android devices)
  4. Handle TLS Interception To inject headers into HTTPS traffic, your proxy must perform TLS termination: o Use a custom root certificate trusted by the device o Intercept and re-encrypt traffic after injecting headers
EXPERT

answered a year ago

0

Hey,

Hope you're keeping well.

In AWS Device Farm, you can route private device traffic through a proxy by enabling VPC connectivity for your project and placing a transparent HTTPS proxy inside your VPC. Configure the proxy to terminate TLS with a trusted root certificate on the device, inject the required headers, then re-encrypt before forwarding. You’ll need to adjust the device or test host network settings to point to the proxy, either via environment variables like HTTPS_PROXY or system proxy configuration during test setup. This approach ensures all outbound calls from the device pass through your proxy for logging and header injection.

Thanks and regards,
Taz

answered 10 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.