[GIS] mapserver: accessing mapfile with localhost instead of system path

apachemapfilemapserver

Don't know if GIS SE is the right place to ask this question. Otherwise, please feel free to suggest me where should I migrate it.

I need to access my mapfile with localhost to test my service via my intranet.
At present, if I call:

http://localhost/cgi-bin/mapserver/mapserv.exe?map=C:/mapserver/umbe/mapfile/test7.map&mode=map

it works, while if I do:

http://localhost/cgi-bin/mapserver/mapserv.exe?map=http://localhost/mapserver/umbe/mapfile/test7.map&mode=map

it throws:

msLoadMap(): Unable to access file. (http://localhost/mapserver/umbe/mapfile/test7.map)

I guess it's a problem of folder/file permission, but I don't know how to solve it. I am using XAMPP, Apache web server with a Windows 10 OS. MapServer is version 7.0.4.

Best Answer

The map file is an internally referenced parameter, it should only be referenced using a file path, not a URL.

On Apache, you can use SetEnvIf to remove it from your URL, something like:

SetEnvIf Request_URI "/cgi-bin/mapserver/mapserv.exe"  MS_map file=C:/mapserver/umbe/mapfile/test7.map
Related Question