HelpOverFlow
HelpOverFlow

Reputation: 335

MapServer: Hide the Map parameter .map Path

I am having a hard time trying to figure out how to hide the file path value of Query String MAP parameter available on a MapServer request as shown bellow: http://192.168.15.150/mapserver?MAP=/data/config/map/nasaww.map&%20service=wms&version=1.3.0&CRS=CRS:84&REQUEST=GetMap&FORMAT=image/jpeg&SRS=EPSG:4326&BBOX=-170,-90,170,90&WIDTH=600&HEIGHT=600&LAYERS=BlueMarble-200407&STYLE=raster I am trying two solutions:

  1. Based on MapServer Env Variables - However this solution hind the MAP variable or replace the MAP value for a variable. Not really what I am looking for.

  2. Use the Apache mod_rewrite as shown here. I have configured my Virtualhost as shown bellow:

    <Directory /data> Options Indexes FollowSymLinks AllowOverride AuthConfig Order allow,deny Allow from all RewriteEngine on RewriteCond %{REQUEST_URI} ^/mapserver/?$ RewriteCond %{QUERY_STRING} (^|&)MAP=([A-Z]).map(&|$) [NC] RewriteRule (.) http://192.168.15.150/wms?MAP=/data/config/map/%1 [R=301,NC,L,QSA]
    Alias /mapserver /usr/lib/cgi-bin/mapserv <location /mapserver> setHandler cgi-script Options +ExecCGI -MultiViews +FollowSymLinks AddHandler fcgid-script .fcgi Require all granted SetEnv MY_PATH "/data/config/map/" SetEnv MY_MAPFILE "/data/config/map/nasaww.map"

The Apache rewrite solution still did not work. Would anyone point me to any miss-configuration or give me some highlights to achieve my goal.

Upvotes: 0

Views: 495

Answers (1)

mapserving
mapserving

Reputation: 220

This is fully documented (by me, small world) on the official MapServer site, which gives several options for you to hide the map= parameter from the request: https://mapserver.org/ogc/wms_server.html#changing-the-online-resource-url

That said, you might ask though 'which one do you recommend?', and here's my answer:

Let me know if that documentation needs any updates. Thanks! -jeff

Upvotes: 2

Related Questions