HTTPS server postal consultation

2

I'm trying to request the address for the zip in a website, but it is giving the following error:

  

Mixed Content: The page at ' link ' was loaded over HTTPS,   but requested an insecure XMLHttpRequest endpoint   ' link '. This request has   been blocked; the content should be served over HTTPS.

The server that my site is hosted is HTTPS so I believe that is the problem ... does anyone know of a site for consultation that is also HTTPS so as not to give security error?

    
asked by anonymous 17.03.2016 / 15:58

2 answers

2

When you use the HTTPS protocol and need to make requests, they must be via HTTPS. For security reasons.

In your case your server is using HTTPS but the Post Office Web Service does not, so it does not allow you to make a request to the post office because it is considered insecure.

But you can do HTTPS protocol requests via HTTP, example: CDN.

Most current browsers block this type of request, Mixed Content .

  

For third-party domains , use the HTTPS version of the site, if available . If HTTPS is not available, you can try to sign in.   contact the domain and ask if they can make the content   available via HTTPS.

Sources:
What is Mixed Content?
How to fix a website with blocked mixed content

    
17.03.2016 / 16:30
0

Silvan, good? Since you are using Laravel , how about using a Proxinig ?

It will work as follows: You get send a request to the zip url by Laravel , and by jQuery , you send the request to Laravel .

It will avoid many headaches, since you will be making the request for your own domain:

Route::get('cep/{cep}', function ($cep)
{
     $url = sprintf('http://cep.correiocontrol.com.br/%s.json', $cep);

     $json = json_decode(file_get_contents($url), true);

     return Response::json($json);
});

In your jQuery, just do this:

$.get('/cep/' + cep, {}, function (response) { /** ... **/ });

The advantage of this type of request is that you do not have to worry about these chatisses limitations placed on browsers.

Understand more about it at:

What is the name of the operation when we make an ajax request to the internal server which in turn takes information from external?

    
17.03.2016 / 19:30