Hello all, I have an issue with WireMock running i...
# help
s
Hello all, I have an issue with WireMock running in a Kubernetes cluster where we have 4 different scenarios 1. Return fixed or templates stubs 2. Proxy to another service via the
proxyBaseUrl
3. Let go traffic to the original destination (out of cluster) 4. Redirect traffic to another service inside the cluster The problem I'm facing is that for #3 to work I need to redirect the traffic via an external proxy, so I started up WireMock with
--proxy-via
but I need to exclude local calls (
.svc.cluster.local
) from that proxy (#4). I would usually use the NO_PROXY environment variable, but I don't think that's even available, right? Does anybody has a suggestion?
r
couldnt you create a stub that matches any internal calls and redirects appropriately?
s
No, because I need to redirect through an outbound proxy setup by my company... so basically traffic that goes out of the cluster needs to go through a proxy... while internal traffic cannot use this proxy. That's why we usually have the
HTTP_PROXY
,
HTTPS_PROXY
, and
NO_PROXY
environment variables. I whish WireMock would use and honor these standard variables 馃槥
Wait... is there a way I can create a stub for every call from A to B to send it through a proxy C? I mean using C as a proxy to B, not changing the destination. So far I've used
proxyBaseUrl
to redirect calls to another service, but maybe there's a way I'm not aware of
r
i see. unfortunately i dont think there's a way to do that in wiremock
can you explain the proxy environment variables you're referring to?
s
Probably originated by curl or linux itself, it's a pretty standard way of defining a proxy for different applications. https://superuser.com/questions/944958/are-http-proxy-https-proxy-and-no-proxy-environment-variables-standard
r
i see. this could be a good addition to the oss. feel free to raise an issue on github and even create a pr if you feel like contributing
in the meantime, is it possible to create a separate proxy within your cluster that knows how to handle internal and external requests that wiremock could proxy via?
s
yeah, I'll figure out how to do it... I will create an issue and I thought about opening a PR, the thing is we might need some discussion on how NOT the break backward compatibility, which could be a real challenge