Hello i’m running WireMock as a server (WireMockSe...
# help
Hello i’m running WireMock as a server (WireMockServer) and use the enableBrowserProxying=true, i would like to know how to return a stub response when the request is not matched. currently it’s always passing the request to the external url. Consuming application sends this request with stub server as forward proxy e.g. Request url https://www.sample.com/api/pattern proxy: stub-server-host:4000 Wiremock should return http 404 when the request pattern /api/pattern does not match with any stub mapping Is it correct that the following payload must be sent to the API { ... “proxyPassThrough”: false } What is the full request payload and wiremock rest api url for this?
Hi Jackie,
is a startup and global settings parameter. The easiest way to set it is at startup, so
on the CLI or
in the options builder if you’re starting programmatically.
Another option if you want to customise the 404 response is to create a stub that matches any method, any URL, has low priority e.g. 9 and returns whatever 404 response you want.
Hi @Tom i’m using wiremock-jre8 2.33.2 and don’t see the proxyPassThrough api in the WireMockConfiguration class which i would like to start it programmatically. could you please suggest?
You’ll need to use the latest 3.x version to access this parameter