I am trying to test a REST API having an ELB similar to below:
https://systemtest-inventory.com/v1/inventory/getInventory
When I tried the URL with postman chrome, it is giving me valid response.
But when I try to use it in Java program as below:
RestAssured.baseURI="https://systemtest-inventory.com/";
RestAssured.get("v1/inventory/getInventory").then().assertThat().contentType(ContentType.JSON);
It gives this error:
org.apache.http.conn.HttpHostConnectException: Connection to
https://systemtest-inventory.com refused
I am aware that I am using HTTPS and need to have security certificate trusted. However, I am not sure how to do it. Is there any way in Rest assured to test with HTTPS and not HTTP.
You could do something as below for ignoring HTTPS Validation:
given().config(RestAssured.config().sslConfig( new SSLConfig().relaxedHTTPSValidation());
To ignore the HTTPS Connection you can use:
RestAssured.useRelaxedHTTPSValidation();
Related
I am writing an HTTPS proxy in play framework, yet every time I try to run it on a website that has ssl encryption I am getting this error in my server:
akka.actor.ActorSystemImpl(play-dev-mode) Illegal request, responding with status '400 Bad Request': CONNECT requests are not suppo
rted: Rejecting CONNECT request to '//any.website:443'
The proxy works well on HTTP, yet HTTPS is the problem. I tried changing my application.conf to have a port destined to work on HTTPS, but when I try to run it with the keystore i setup using the keytool command I am getting the following error in my browser:
Secure Connection Failed
The connection to the server was reset while the page was loading.
The page you are trying to view cannot be shown because the authenticity of the received data could not be verified.
Please contact the website owners to inform them of this problem.
Any workaround to allow HTTPS on a play framework proxy server?
So I'm trying to send a HTTPS request to my Flask application. Before, it worked successfully using just HTTP. Now, I wanted to change it to HTTPS.
But it does not work unfortunately. In my Java IDE, and my Python IDE, I get these errors:
javax.net.ssl.SSLException: Unsupported or unrecognized SSL message (Java client side)
code 400, message Bad request version ("\x1bè\x13\x16)... and
"‚ ~ˆòÎ×ý›tYê >ôeïõ?2ŸÏËðÚü$ü^d ‰ô$NªO5~EN4ë=Y8õûb~ïÁ¢˜è) bÀ,À+Ì©À0̨À/ ŸÌª £ ž ¢À$À(À#À' k j g #À.À2À-À1À&ÀÀ%À)À" HTTPStatus.BAD_REQUEST* (Flask server side)
My code for sending the request is:
URL myURL = new URL(requestUrl);
HttpsURLConnection connection = (HttpsURLConnection) myURL.openConnection();
connection.setRequestMethod("GET");
System.out.println(connection.getResponseCode());
...
Basically, I just changed my connection object to Https, and also modified the URL string to use "https" instead. It worked perfect with HTTP, and now, nothing works with HTTPS.
What do I have to do to get it working with HTTPS?
EDIT: In my Flask application, I changed app.run to also include parameter ssl_context='adhoc'. Now I get a different exception:
javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
ssl_context='adhoc' is the right way.
This generates a custom SSL cert and you can access your Flask app via https.
But...
As this cert is self signed, your client (Browser, curl, or Java Application) does not trust the cert.
That is why you get error messages.
Have a look at the following blog post to learn more what you can do about it:
https://blog.miguelgrinberg.com/post/running-your-flask-application-over-https
I have a get (http) request in my Java code, in localhost I can run normally, my code works, but in production I get no response. Returns error 500.
When I test my production request by Postman, it returns a message missing SSL certificate. My questions are how to solve this problem and is the error possible due to lack of SSL?
My production site does not have SSL certificate
I would like to write a SSL MITM proxy using Jetty. I've gone through some examples and it seems that I can use org.eclipse.jetty.server.handler.ConnectHandler for HTTPS Connect tunneling.
Is there any way that I can set my own certificate and decrypt content using ConnectHandler?
I am facing this problem, i am calling an http url via SOAPConnection.call() method, it works fine, but when i use an https url it doesn't work. How to configure SSL in this scenario?