Hello everyone, I'm working on some wiremock proj...
# help
p
Hello everyone, I'm working on some wiremock project using Scala and i'm now creating wiremock instance in my scala code and make it act as Browser Proxy , it works fine when i use it with firefox and http site(that set proxy to localhost:8080) but when it comes to https (of the same site) it does not work , firefox say
NS_ERROR_UNKNOWN_HOST
, but if i use wiremock standalone (.jar file) and running as browser proxy everything works perfectly , Appreciate for your guidance / clue , thx a lot below is my scala code (Not work with https site )
Copy code
w = new WireMockServer(op.httpsPort(8443)
          .caKeystoreType("jks")
          .trustAllProxyTargets(false)
          .caKeystorePath("/Users/oz4899/.wiremock/ca-keystore.jks")
          .enableBrowserProxying(true)
          .notifier(new ConsoleNotifier(true)))
        w.start()
below is command that i used to run standalone (work fines)
Copy code
java -jar wiremock-standalone-3.3.1.jar --enable-browser-proxying --port 8080 --verbose
t
When running with Firefox, did you add the CA certificate to the ones trusted by the browser?
p
I didn't explicitly add any CA certificate to firefox for both use cases , for standalone use cases i get warning as shown in image and i click add security exception and things work fine but on my scala code with wiremock , firefox not even tell me the warning to excep security, if there are any addiitional steps appreciate ur guidance
t
I suggest you try adding the CA cert as trusted by Firefox. You can find out more about that here: https://wiremock.org/docs/proxying/#getting-your-client-to-trust-the-certificate-presented-by-wiremock
p
thx , i just tried to download cert and trust but wiremock (in my scala code) returned this error. while when try to access same url with standalone wiremock , it can give me wiremock-ca.crt file download correctly
ps. my scala run on Java 11.0
t
Are you using the latest version of WireMock from Scala also? I don’t recognise that message at all, not sure where that’s coming from.
p
not the latest one , should i upgrade it ?
t
Yes, that one is ancient. I recommend using the latest - 3.3.1 everywhere (drop the jre8 bit from the artifact name).
p
Ok, thx Tom let me try it tonite(my time) , i will come back and keep u posted , really appreciate the help
t
No problem!
p
Hi after updated to wiremock 3.0.1 dependencies everything works fine as expected , thx a lot for all your support @Tom appreciate it 🙂
👍 1