0

I have recently built a website using MapServer for an academic course. The course is finished, but I wanted to continue developing it. The website is using Apache/2.4.53 (Debian), running on Debian 11, set up as a Virtual Host.

I have recently installed https using Let's Encrypt. The website works when using either http (http://kina3.net/) or https (https://kina3.net/), so I know that https is working.

I can serve up a example file through MapServer when using: http://kina3.net/cgi-bin/mapserv?map=bluemarble&mode=map

However when I try using https://kina3.net/cgi-bin/mapserv?map=bluemarble&mode=map it generates the following error: msLoadMap(): Regular expression error. MS_DEFAULT_MAPFILE_PATTERN validation failed.

My research (MS_DEFAULT_MAPFILE_PATTERN validation failed) suggests that problem is because "The map location is missing or wrongly formatted". However in the apache2 VirtualHosts config file both references point to the same mapfile. See extract from site configuration file below:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost
    ServerName kina3.net
    ServerAlias www.kina3.net
#    Redirect permanent / https://kina3.net
    DocumentRoot /var/www/kina3.net
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

    SetEnv bluemarble "/var/www/map/bluemarble.map"

</VirtualHost>

### ERROR LOGS IN /var/log/apache2/access.log ###

<VirtualHost *:443>
    ServerAdmin webmaster@localhost
    ServerName kina3.net
    ServerAlias www.kina3.net
    DocumentRoot /var/www/kina3.net
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    SSLEngine on
    SSLCertificateFile /****
    SSLCertificateKeyFile /****
    Include /****

    SetEnv bluemarble "/var/www/map/bluemarble.map"

</VirtualHost> 

What am i missing?

user19425
  • 11
  • 3

1 Answers1

0

I managed to fix this problem ... and it's not glorious. Turns out that I had two VirtualHosts files running, with the other one taking precedence. So whatever changes I made in the VH example above would have no effect as the other took precedence. So if you find yourself with a similar problem to me, try running:

sudo apachectl -S

and see what the VirtualHost configuration: is pointing to.

Also, once you post a link to your own website on StackOverflow, expect regular visits from web scrapers plus various shady IP addresses.

user19425
  • 11
  • 3