[mapserver-users] URL redirection under Apache2-Difference WMS and WFS server

thomas bonfort thomas.bonfort at gmail.com
Fri Sep 4 09:59:47 PDT 2015


I'd avoid using the SERVICE= rewrites as the handling of capital
letters may prove to be problematic. You should also not be adding the
REQUEST= and other parts in your rewrite rule.

Basically, just:

<Directory “…/public_html”>

RewriteEngine on

RewriteRule mywms(.*)?(.*)$
/cgi-bin/mapserv?map=/var/www/biss.org/public_html/pmapper/config/default/pmapper_demo_wms$1.map&$2
RewriteRule mywfs(.*)?(.*)$
/cgi-bin/mapserv?map=/var/www/biss.org/public_html/pmapper/config/default/pmapper_demo_wfs$1.map&$2

</Directory>

--
thomas

On 4 September 2015 at 16:54, Pasquale Regina <pasquale.regina at enea.it> wrote:
> Greetings to everyone on the user list.
>
> Sorry for my english.
>
> I have a problem to submit because I cannot frame it properly: I do not
> expect that you will solve it but you can provide guidance on how to deal
> with it and I move on.
>
> According with mapserver wms server howto at
> http://mapserver.org/ogc/wms_server.html, in section “Changing the Online
> Resource URL” I follow the indication “Apache environment variables –
> MS_MAPFILE”. So I create a link in http cgi-bin folder named mywms which
> points to /usr/lib/cgi-bin/mapserv, the application/executable file.
>
> My http.conf file contain instruction:
>
> Alias /mywms /usr/lib/cgi-bin/mapserver
>
> <Location /mywms>
>
> SetHandler cgi-script
>
> Options ExecCGI
>
> SetEnv MS_MAPFILE
> /var/www/biss.org/public_html/pmapper/config/default/pmapper_demo_wms.map
>
> </Location>
>
> And the application correctly works and in a wms gis client I can connect to
> wms server with follow link www.biss.org/mywms.
>
> This is configuration to access to a single default mapfile
> (pmapper_demo_wms.map).
>
> In a similar way for a wfs server with pmapper_demo_wfs.map (mywfs link in
> cgi-bin folder, …)
>
>
>
> My project manager wants to change the settings of project by create
> individual mapfile (not only one, the default) for each registered user and
> so I need  to access the individual mapfiles inserting different links: in
> other words in a wms gis client I put the link www.biss.org/mywms_123_45 to
> point to the file pmapper_demo_wms_123_45.map (123_45 represents a
> registered user id, one of actually 75 registered users!! So I don’t create
> 75 and on link…). The map files are created automatically by the database on
> user’s registration for both wms e wfs mapfile.
>
> So I changed in http.conf toward rewrite rule solution (and remove
> references to Alias /mywxx and <Location /mywxx> for both mywms and mywfs)
>
> in
>
> <Directory “…/public_html”>
>
> ….
>
> RewriteEngine on
>
> RewriteRule myw?(.)s(.*)$
> /cgi-bin/mapserv?map=/var/www/biss.org/public_html/pmapper/config/default/pmapper_demo_w$1s$2.map&SERVICE=W$1S&REQUEST=GetCapabilities&
>
> </Directory>
>
> So when I put http://www.biss.org/mywms_123_45 in QGIS --> add WMS layer it
> works because point to
> pmapper_demo_wms_123_45.map&SERVICE=WmS&REQUEST=GetCapabilities according to
> $1=m and $2=_123_45 variables.
>
> The problem arises with wfs request in QGIS à add WFS vector. Putting
> http://www.biss.org/mywfs_123_45 QGIS (and other wfs client similar) sends
> the response in attached “Il server WFS non supporta la versione WFS 1.0.0
> oppure l’ URL è errato” (Italian language!!) while putting
> http://www.biss.org/cgi-bin/mapserv?map=/var/www/biss.org/public_html/pmapper/config/default/pmapper_demo_wfs_123_45.map
> it works correctly (which demonstrate that mapfile is ok! and in the layer
> properties I read correctly …&SERVICE=WFS&VERSION=1.0.0&REQ….)
>
> what it is due to the difference in behavior for mapserver when rewrite the
> url? Is it a feature of wfs server?
>
> Can you direct me?
>
> Thanks in advance. Pasquale.
>
> PS. Apache2 version 2.4.7 on Ubuntu 14.04 MapServer 6.4.1
>
>
>
>
>
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users


More information about the mapserver-users mailing list