Question: Can WireMock select different mTLS client certificates per proxy stub?
Hi everyone,
I'm working on a shared WireMock setup running on OpenShift, and I have a question about proxy + mTLS.
We're trying to build a shared WireMock platform shared by multiple projects. To avoid collisions, each project uses its own URL prefix, like:
/project-a/...
/project-b/...
Each project also has its own proxy mapping, something like:
{
"request": {
"method": "ANY",
"urlPathPattern": "/project-a/service/.*"
},
"response": {
"proxyBaseUrl": "
backend-a.example.com",
"proxyUrlPrefixToRemove": "/project-a"
}
}
This part works well.
The challenge is that some backend APIs require different mTLS client certificates, and each project has its own certificate.
Since WireMock already knows which proxy stub matched before it sends the proxied request, I was wondering if there's any way to choose a different client certificate (or keystore alias/SSLContext) based on that matched stub.
I couldn't find anything in the documentation about this.
Is this supported somehow? If not, is there an extension point for customizing the HTTP client used by the proxy, or is the recommended approach to run one WireMock instance per client certificate?
Has anyone dealt with a similar setup?
Thanks!