🇳🇦Namibia @namwebs

Account created on 26 March 2012, over 12 years ago
#

Recent comments

🇳🇦Namibia namwebs

In case it helps someone, this is what we did to get around the mixed content problem (of having the site on https and the geoserver on http):

1. In Map Layers, point the URL template to a local php file e.g.https://mysite-url/tile.php
2. In the php file, have this code:

<?php

  $sourceURL = 'http://mygeoserverrul:8080/geoserver/foldername/wms';
  $newURL = $sourceURL.'?'. http_build_query($_REQUEST);
 
  if (!file_exists("./tiles")) {
    mkdir("./tiles");
  }

  $fileLocation = "./tiles/".md5($newURL).".png";
  if (!file_exists($fileLocation)) {
     $curl = curl_init();
     curl_setopt($curl, CURLOPT_URL, $newURL);
     curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
     curl_setopt($curl, CURLOPT_HEADER, false);
     $imageData = curl_exec($curl);

     curl_close($curl);
     file_put_contents($fileLocation, $imageData);
     
  }
  header("Content-type: ".mime_content_type($fileLocation));
  echo file_get_contents($fileLocation);
  die();

As long as you don't have commas or special characters in the geoserver filename, this works perfectly (for my use case, at least!).

🇳🇦Namibia namwebs

Thanks andeersg for your response. I'm looking into that.

This issue can be marked closed, I suppose, since it's not really a problem with the module itself.

🇳🇦Namibia namwebs

Hi,

Thanks for the response. Yes, this is definitely the problem. The message is

temp:1 Mixed Content: The page at 'https://mywebsite/temp' was loaded over HTTPS, but requested an insecure element 'http://mygeoserverurl:8080/geoserver/speciesmaps/wms?service=WMS&request=GetMap&layers=...etc'. This request was automatically upgraded to HTTPS.

So then it is a browser issue and not a module issue. I'm not sure how to get round this. I can't upgrade the geoserver to https. Is there a way to directly load a shapefile in leaflet layers?

Thanks.

Production build 0.71.5 2024