[MapServer-users] Frustrating error: msLoadMap(): Regular expression error. Filename validation failed
Seth G
sethg at geographika.co.uk
Mon Feb 10 09:51:27 PST 2025
Hi Tim,
That error should only occur when the validation of the map= parameter fails.
Did you try MS_MAP_PATTERN "." in the CONFIG?
Do you have any other security settings in the CONFIG such as MS_CONTEXT_BAD_PATTERN or MS_MAP_NO_PATH?
Are there any URL rewrites happening which could affect the map= parameter?
Seth
--
web:https://geographika.net & https://mapserverstudio.net
mastodon: @geographika at mastodon.social
On Mon, Feb 10, 2025, at 5:21 PM, Pascoe,Tim (ECCC) wrote:
> Seth,
>
> I double-checked the allowPathInfo in my IIS config, and it is set to TRUE already. I tried altering the MAP KEY value, to locate the Map Files in the actual Mapserver directory, rather than the separate directory the app is configured for. Changing this location resulted in the following error:
>
> msCGILoadMap(): Web application error. CGI variable "map" fails to validate.
>
> So the Config file is being read, but the validation error is still there, although the message is subtly different.
>
> *Timothy Pascoe***
>
> Please note the return to our departmental E-mail address below. My Canada.ca address will also continue to work for the time being/Veuillez noter le retour à notre adresse électronique départementale ci-dessous. Mon adresse Canada.ca continuera également à fonctionner pour le moment.
>
> Environmental Scientist, Water Quality Monitoring & Surveillance
> Environment & Climate Change Canada (ECCC)
> tim.pascoe at ec.gc.ca T: 905-336-6239 / C: 289-253-7857
>
> Scientifique de l’environement, Surveillance de la qualité de l'eau
> Environnement et Changement climatique Canada (ECCC)
> tim.pascoe at ec.gc.ca T: 905-336-6239 / C: 289-253-7857
>
> Environment Canada
>
> *From:* Seth G <sethg at geographika.co.uk>
> *Sent:* Friday, February 7, 2025 9:37 AM
> *To:* Pascoe,Tim (ECCC) <Tim.Pascoe at ec.gc.ca>; MapServer Users <mapserver-users at lists.osgeo.org>
> *Subject:* Re: [MapServer-users] Frustrating error: msLoadMap(): Regular expression error. Filename validation failed
>
> Hi Tim,
>
> From https://mapserver.org/installation/iis.html#troubleshooting
>
> The following error is returned (from MapServer 8.0) if ` allowPathInfo="false"` is set in the `handlers` section for MapServer in the `web.config` file. This should be set to `true`:
>
> msLoadMap(): Regular expression error. MS_DEFAULT_MAPFILE_PATTERN validation failed.
>
> You could also try the following in your CONFIG file. Note you'll need to restart IIS to pick up any changes. Also try adding some broken syntax (e.g. CONFIGX) to check the file is being picked up.
>
> CONFIG
> ENV
> MS_MAP_PATTERN "."
>
>
> Seth
>
> --
> web:https://geographika.net & https://mapserverstudio.net
> mastodon: @geographika at mastodon.social
>
> On Fri, Feb 7, 2025, at 3:25 PM, Pascoe, Tim (ECCC) via MapServer-users wrote:
>> I’m working on porting a development environment to our production server. Using:
>>
>>
>>
>> Mapserver 8.2.2 binaries from GISInternals
>>
>> IIS 10
>>
>> Windows Server 2016
>>
>>
>>
>> The permissions are the same on both servers, I have Mapserver set up as a FastCGI module and have the MAPSERVER_CONFIG_FILE Env variable set. I’ve attached the Config file here, but it’s pretty simple, and I can confirm it’s being read.
>>
>>
>>
>> The error I’m getting is: msLoadMap(): Regular expression error. Filename validation failed
>>
>>
>>
>> I’ve googled this, and only found one other user who seemed to have a similar problem. They never posted a clear solution, and their workaround was to point to the endpoint with no mapserv.exe in the path (just the endpoint), but had no idea why this worked. It did not work for me, however. What is confusing is that I have no validation for the files. I have a MAPS key set, which works on Development, and have set the MS_MAP_PATTERN to *.* to try and eliminate any validation mistakes. The map files are ones that have been in use for some time, with no issues. Hitting just the raw endpoint delivers the expected ‘QUERY_STRING is set, but empty. ’but still also includes the Filename validation error.
>>
>>
>>
>> Am I missing a PATH environment variable that is required?
>>
>> Anyone have any ideas for me to test out?
>>
>>
>>
>> *Timothy Pascoe*
>>
>>
>>
>> Please note the return to our departmental E-mail address below. My Canada.ca address will also continue to work for the time being/Veuillez noter le retour à notre adresse électronique départementale ci-dessous. Mon adresse Canada.ca continuera également à fonctionner pour le moment.
>>
>>
>>
>> Environmental Scientist, Water Quality Monitoring & Surveillance
>> Environment & Climate Change Canada (ECCC)
>>
>> tim.pascoe at ec.gc.ca T: 905-336-6239 / C: 289-253-7857
>>
>>
>>
>> Scientifique de l’environement, Surveillance de la qualité de l'eau
>>
>> Environnement et Changement climatique Canada (ECCC)
>>
>> tim.pascoe at ec.gc.ca T: 905-336-6239 / C: 289-253-7857
>>
>>
>>
>> Environment Canada
>>
>>
>>
>> _______________________________________________
>> MapServer-users mailing list
>> MapServer-users at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/mapserver-users
>>
>>
>> *Attachments:*
>> • mapserver.conf
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20250210/8eb431a3/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.gif
Type: image/gif
Size: 2185 bytes
Desc: not available
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20250210/8eb431a3/attachment-0001.gif>
More information about the MapServer-users
mailing list