title: Cannot access MapServer when using Let's Encrypt HTTPS on Apache2
body: <p>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.</p>
  <p>I have recently installed https using Let's Encrypt.
  The website works when using either http (<a href="http://kina3.net/" rel="nofollow noreferrer">http://kina3.net/</a>) or https (<a href="https://kina3.net/" rel="nofollow noreferrer">https://kina3.net/</a>), so I know that https is working.</p>
  <p>I can serve up a example file through MapServer when using: <a href="http://kina3.net/cgi-bin/mapserv?map=bluemarble&amp;mode=map" rel="nofollow noreferrer">http://kina3.net/cgi-bin/mapserv?map=bluemarble&amp;mode=map</a></p>
  <p>However when I try using <a href="https://kina3.net/cgi-bin/mapserv?map=bluemarble&amp;mode=map" rel="nofollow noreferrer">https://kina3.net/cgi-bin/mapserv?map=bluemarble&amp;mode=map</a> it generates the following error:
  <code>msLoadMap(): Regular expression error. MS_DEFAULT_MAPFILE_PATTERN validation failed.</code></p>
  <p>My research (<a href="https://stackoverflow.com/questions/13475877/ms-default-mapfile-pattern-validation-failed">MS_DEFAULT_MAPFILE_PATTERN validation failed</a>) suggests that problem is because <em>&quot;The map location is missing or wrongly formatted&quot;</em>.
  However in the apache2 VirtualHosts config file both references point to the same mapfile. See extract from site configuration file below:</p>
  <pre><code>&lt;VirtualHost *:80&gt;
      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 &quot;/var/www/map/bluemarble.map&quot;
  
  &lt;/VirtualHost&gt;
  
  ### ERROR LOGS IN /var/log/apache2/access.log ###
  
  &lt;VirtualHost *:443&gt;
      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 &quot;/var/www/map/bluemarble.map&quot;
  
  &lt;/VirtualHost&gt; 
  </code></pre>
  <p>What am i missing?</p>