I need to get data from the external website, preferably from Visualforce. I ran into some CORS issues. The URL for target website: https://geoportaal.maaamet.ee/url/xgis-latlon.php?lat=59.42231819853315&lon=24.651416477162787&out=tunnus'

I added the target domain to my salesfroce CORS whitelist. Also I added the domain to Remote Site Settings.

In visualforce I try to get the data like that:

function getCadastrialIdentity(latitude, longitude) {
  var address = 'https://geoportaal.maaamet.ee/url/xgis-latlon.php?lat=59.42231819853315&lon=24.651416477162787&out=tunnus';
  var request = new XMLHttpRequest();
  request.open("GET", address);

  request.setRequestHeader('Access-Control-Allow-Headers', 'Origin, Content-Type, X-Auth-Token');
  request.setRequestHeader("Access-Control-Allow-Origin", 'HEAD, GET, POST, PUT, PATCH, DELETE');
  request.setRequestHeader("Access-Control-Allow-Methods", '*');

  request.onload = function () {

And i get the following error in my chrome developer console: enter image description here

Also i tryed to make this call from APEX:

 // Instantiate a new http object
Http h = new Http();
String url = 'https://geoportaal.maaamet.ee/url/xgis-latlon.php?lat=59.42231819853315&lon=24.651416477162787&out=tunnus';
HttpRequest req = new HttpRequest();

// Send the request, and return a response
HttpResponse res = h.send(req);

And the message i got from the execution: enter image description here

Anybody know where i am going wrong or what i am missing here?

Thanks in advance!

  • 1
    You are getting TLSv1 error in Apex because Salesforce has removed the support for it. You should check with the server admin to enable TLSv1.1 or greater. help.salesforce.com/articleView?id=000221207&type=1 – Sven Jun 6 '18 at 6:52
  • @Sven Thanks for the response. Unfortunately, I do not have access to this external server. – RSICK Jun 6 '18 at 6:59
  • A large number of other websites no longer support this protocol either. Its outdated and unsafe. It might be worth contacting the admins of this external site to ask why they use an unsafe protocol. If they can't switch, they'll lose both your business & future customers, not to mention leaving a vulnerability in their servers. – battery.cord Jun 6 '18 at 13:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.