This message was deleted.
# help
s
This message was deleted.
t
I’m not sure TBH, so I think you’d need to dig into the Apache HTTP client to figure this out. You can definitely set the UA at client setup time, but I don’t know if it supports doing it per request. It is possible to substitute the whole HTTP client via
HttpClientFactory
so that’s the nuclear option if you can’t get the Apache client to play.
ž
Thanks for your response, Tom. I just cloned the Wiremock repo and removed the User-agent from the FORBIDDEN_REQUEST_HEADERS list, by changing the line in
com.github.tomakehurst.wiremock.http.client.HttpClient
Copy code
List<String> FORBIDDEN_REQUEST_HEADERS = List.of(TRANSFER_ENCODING, CONTENT_LENGTH, "connection", USER_AGENT);
to
Copy code
List<String> FORBIDDEN_REQUEST_HEADERS = List.of(TRANSFER_ENCODING, CONTENT_LENGTH, "connection");
… and now the proper user-agent is forwarded to the server Do you know, is there a reason why this header is forbidden to be forwarded?
t
Good spot. I can’t remember whether I did that or what the reason was TBH.
Perhaps we could create a config parameter called
preserveUserAgentProxyHeader
in the same fashion as
preserveHostHeader
I don’t think I’d want to just drop this, as in some cases at least you want the last caller in the chain to present the UA
ž
That would be a life-saver! 🙌
t
Do you feel like creating a PR?
ž
I’ll do my best - I’m working on it 🙂
t
Thanks. Will definitely happen quicker that way.
ž
In your opinion, is there a dependency which flag should this preserveUserAgentProxyHeader be used with? e.g.
proxyAll
or
enableBrowserProxying
or none …?
t
No, because it could just be a proxy stub
1
131 Views