SSL Error when requesting to https backend


#1

Hi,

I have a backend something like this: https://exmple.net/login. When I send request from my ionic 2 app to backend via ios device or simulator , I am getting following error:

Failed to load resource: An SSL error has occurred and a secure connection to the server cannot be made.

Do I have to embed SSL certificate inside of ionic app or do I have to do something else?

Thanx in advance


#2

Nobody has the same problem?


#3

Obviously not in the last 28 minutes you took before bumping your topic.

Show us the code used to request that URL in your Ionic app.
You can do the same request in e.g. Postman? (or browser if it is just a GET request?)


#4

Thanks for reply!

It is just GET request with

.requestOptions.withCredentials = true;

After I set Allow-Control-Origin:*, it is working in POSTMAN and browser. But I know it is not a safe way.
I have already had ssl certificate from backend but I don’t know what should I do with it right now.


#5

What does [quote=“Meliha, post:4, topic:90042”]
.requestOptions.withCredentials = true;
[/quote]

or [quote=“Meliha, post:4, topic:90042”]
After I set Allow-Control-Origin:*, it is working
[/quote]

have to do with an SSL Error?

Is it a proper certificate or did you have to do things in Chrome to accept it?

Also: You didn’t post any code of how you do the request.


#6

I have a proper certificate.
My request to backend:

let requestOptions = new RequestOptions({
url: https://exmple.net/login
});

this.http.get(new Request(requestOptions));

And after executing this request I am getting following error on IOS device or simulator

Failed to load resource: An SSL error has occurred and a secure connection to the server cannot be made.

And after executing same request on web I am getting following error:

XMLHttpRequest cannot load https://exmple.net/login. It has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘http://localhost:8100’ is therefore not allowed access.

That is my exact problem


#7

Google for the error message, first result:


And here the Cordova plugin so solve this:
https://github.com/leecrossley/cordova-plugin-transport-security

Why are you posting here if you didn’t even google the error message?


#8

Two very different, totally unrelated problems.


#9

How do you know I did not google it?
I asked here to find an answer not rude attack!!!


#10

So did you google the error or didn’t you?
Result #1 was the perfect explanation for why the error is happening.