A
A
AlexDF892019-08-13 13:43:38
PHP
AlexDF89, 2019-08-13 13:43:38

How to disable ssl check on ajax request?

Hello!
The question seems to be banal, but I came across a problem with which I ask for help.
There is a server on which the php file is located, we send an ajax request to this file using the POST method, and the server returns 404 to us.
If we send a request using the GET method, then the php script processes the request.

You ask: "Why the question is called 'How to disable ssl verification on ajax request?'", the fact is that when I send a POST request using Postman and disable the "SSL certificate verification" option in the settings, then the php script processes our request.

var formData = new FormData();
formData.append('message', textarea.val());
formData.append('file1', someFile);

$.ajax({
  url: url,
  type: "POST",
  processData: false,
  contentType: false,
  data: formData,
  error: function(err) {
    console.log(err);
  },
  success: function(response){
     console.log(response);
  }
});


There is nothing special in the php script, we take the data from the form and send it to the mail.

UPD. The page from which the ajax request is sent and the php script are on the same server. It baffles me why we can use GET to access the script, and when POST returns 404. More precisely, 404 is returned when POST is requested, but if we turn off the ssl certificate check, then the php script will work.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
B
Beliyadm, 2019-08-13
@beliyadm

I don’t know what Postman program is, but there is an idea that you should google in the direction of the “cross-domain ajax” request, there are a lot of interesting things

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question