Wiremock proxy forwarding different header's user-agent

34 views Asked by At

I'm using Wiremock to proxy my network from a real device. My current setup is just to forward all network to our BE service. Our service expect a custom user-agent, which is whitelisting the calls, otherwise it gets recognised as bot and blocks all incoming calls.

I'm starting a Wiremock server as standalone with the following command:

java -jar wiremock-standalone-3.4.1.jar --port 9999 --enable-browser-proxying --trust-all-proxy-targets

When I run a test on my device, I can see network being recorded in the following URL:

http://localhost:9999/__admin/requests

All network calls recorded in the logs have a custom user-agent, exactly the same as it was sent from the client. Though, the network calls get rejected with the 403 error code. I checked on our BE and the received user-agent to our BE is apache-httpClient/5.3.1 (Java/17.0.9), which is the reason for our BE to block the reuqest.

I assume the user-agent is rewritten by the Wiremock before is forwarded. So, my question is, how can I avoid this to happening? I want the value of the user-agent to remain the same as it was sent by the client (mobile device).

0

There are 0 answers