Proxy setting for WMS layer overlay

Hi all,
I have put the cesium application (code) in apache webserver (localhost:80). Sandcastle demo etc are working fine. But when i want to use a WMS layer (localhost:8081/geoserver/wms), it is not working as expected. I could figure out that it is happening because of proxy issue however I don't know how and where to enable proxy to get it working. Please help..

I had the same problem and made a proxy in the apache webserver. Go to httpd.conf file and add:

ProxyPass /proxy_address http://path_to_your_wms
ProxyPassReverse /proxy_address http://path_to_your_wms

Also enable (remove the #) the libraries in the same file. I believe they are:

LoadModule proxy_module modules/mod_proxy.so
LoadModule proxy_http_module modules/mod_proxy_http.so

So now you can access your wms via the /proxy_address!

Hope this helps

Lucas

Hi Lucas,
I could do the changes in httpd.conf file as you have told but I could not understand "/proxy_address!". Please explain why and how to use this in the application?

thanks in advance

regards,
Shadab

This is the address you give to the location of the WMS inside your html. In my example:

function addWMS(){
  //create extent for WMS Berlin
  var west = Cesium.Math.toRadians(13.40);
  var south = Cesium.Math.toRadians(52.54);
  var east = Cesium.Math.toRadians(13.43);
  var north = Cesium.Math.toRadians(52.56);
  var extent = new Cesium.Extent(west, south, east, north);
  //add wms
  
    var layers = viewer.centralBody.getImageryLayers();
    var testwms = layers.addImageryProvider(new Cesium.WebMapServiceImageryProvider({
      url: '/wmsberlin',
      layers : '0',
      extent : extent
    }));
    testwms.alpha = 1
  }

So your html is requesting /wmsberlin and then apache is making a proxy from /wmsberlin to the real server address and in reverse.

Good luck