问题
I am experiencing a problem using Cordova 5.1.1 and Apache Ripple 0.9.32. I am trying to connect to a C# Web API 2 web service running in debug in Visual Studio 2013 using IIS Express and a self signed SSL certificate.
Ripple, which is running on the default proxy of http://localhost:4400, reports
INFO: Proxying cross origin XMLHttpRequest - https://localhost:44300/api/account/login
ERROR: Proxying failed with: [Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE]
When I debug the web service without SSL everything works correctly.
Can anyone shed any light on this, or will I need to get an SSL certificate from an authority?
I am aware this may be related to https://stackoverflow.com/questions/32805507/apache-ripple-emulator-and-ssl-test-certificates.
回答1:
Perhaps a config option? From rippled.cfg:
/* If ssl_verify is 1, certificates will be validated
Use this if you have a certificate issued by a Certificate Authority
To allow the use of self-signed certificates for development or internal use,
set this to ssl_verify to 0. */
[ssl_verify]
1
回答2:
I've come up with a workaround which is good enough for now.
- Create a shortcut to run Chrome with the --disable-web-security flag set. For further information see my answer at Visual Studio, Ripple Emulator and CORS/Cross Domain Ajax
- Start Ripple using either the command line or Visual Studio
- Start an instance of Chrome using the shortcut from 1.
- Browse to your Ripple url and issue your request over HTTPS
- This will fail and the dev tools console will show POST https://mydomain:port/api_endpoint net::ERR_INSECURE_RESPONSE
- In a new tab browse to your https://mydomain:port url
- This will result in a "Your connection is not private" web page. Click on "Advanced", and then on "Proceed to https://mydomain:port (unsafe)" to accept the self signed SSL
- Now back on the Ripple tab try issuing your request again and it should succeed.
来源:https://stackoverflow.com/questions/34748432/using-the-apache-ripple-emulator-with-a-self-signed-ssl-certificate