https://linen.dev logo
#help
Title
# help
p

Preeda Payattakool

12/02/2023, 4:39 PM
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

Tom

12/04/2023, 9:38 AM
When running with Firefox, did you add the CA certificate to the ones trusted by the browser?
p

Preeda Payattakool

12/04/2023, 10:08 AM
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

Tom

12/04/2023, 10:11 AM
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

Preeda Payattakool

12/04/2023, 10:17 AM
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

Tom

12/04/2023, 11:00 AM
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

Preeda Payattakool

12/04/2023, 11:04 AM
not the latest one , should i upgrade it ?
t

Tom

12/04/2023, 11:17 AM
Yes, that one is ancient. I recommend using the latest - 3.3.1 everywhere (drop the jre8 bit from the artifact name).
p

Preeda Payattakool

12/04/2023, 11:30 AM
Ok, thx Tom let me try it tonite(my time) , i will come back and keep u posted , really appreciate the help
t

Tom

12/04/2023, 11:34 AM
No problem!
p

Preeda Payattakool

12/05/2023, 3:34 AM
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
5 Views