[mapserver-users] Dynamic wfs_onlineresource

Matthias Müller matthias_mueller at tu-dresden.de
Thu Oct 17 04:37:45 PDT 2019


Yves,

thanks for the hint - it works, but produces an ugly URL that exposes
the FS-Link of the mapfile to the public:

<ows:Get xlink:type="simple" xlink:href="
https://server1.org/mapserver/?map=/opt/service/mapserver/mapfile.map&"/
>

I should have mentioned that a reverse proxy runs in front of
Mapserver, that adds the mapfile to the request:

  location /mapserver {
    # Add header for CORS requests
    add_header Access-Control-Allow-Origin *;

    # Load from /etc/init.d/mapserv
    fastcgi_pass 127.0.0.1:9999;

    # Rewrite url to hide mapfile path
    rewrite ^(/mapserver.*)?(.*)$
$1?map=/opt/service/mapserver/mapfile.map$2 break;

    include fastcgi_params;
    fastcgi_param SCRIPT_NAME /usr/bin/mapserv$fastcgi_script_name;
  }

Is there another solution that works in conjunction with my reverse
proxy? Many other server products respect proxy headers and substitute
the filds of the private internal URL scheme with the corresponding
elements of the public URL of the caller.


- Matthias

Am Donnerstag, den 17.10.2019, 11:37 +0200 schrieb Yves Jacolin:
> Matthias,
> 
> Just remove the parameter will imply that MapServer will find the
> correct online resource.
> 
> Y.
> 
> Le jeu. 17 oct. 2019 à 11:35, Matthias Müller <
> matthias_mueller at tu-dresden.de> a écrit :
> > Hi,
> > 
> > we are running WFS services with similar mapfiles on different
> > servers.
> > 
> > Setting the "wfs_onlineresource" is straight forward, but requires
> > a
> > hard coded host name:
> > 
> > First server:
> >   WEB
> >     METADATA
> >       "wfs_title"          "myserver"
> >       "wfs_onlineresource" "https://server1.org/mapserver?"
> >       "wfs_srs"            "EPSG:4326"
> >       "wfs_enable_request" "*"  # necessary
> >     END
> >   END
> > 
> > 
> > Second server:
> >   WEB
> >     METADATA
> >       "wfs_title"          "myserver"
> >       "wfs_onlineresource" "https://server2.org/mapserver?"
> >       "wfs_srs"            "EPSG:4326"
> >       "wfs_enable_request" "*"  # necessary
> >     END
> >   END
> > 
> > 
> > I there way to let mapserver figure out the hostname from the
> > request
> > and create the appropiate links in the WFS capabilities
> > accordingly?
> > 
> > Something like:
> > 
> >   WEB
> >     METADATA
> >       "wfs_title"          "myserver"
> >       "wfs_online
> > resource" "{request protocol and hostname}/mapserver?"
> >       "wfs_srs"  
> >           "EPSG:4326"
> >       "wfs_enable_request" "*"  # necessary
> >     END
> >   END
> > 
> > 
> > -Matthias
> > 
> > _______________________________________________
> > mapserver-users mailing list
> > mapserver-users at lists.osgeo.org
> > https://lists.osgeo.org/mailman/listinfo/mapserver-users
> 
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20191017/cf79915c/attachment.html>


More information about the mapserver-users mailing list