Particular RewriteCond breaks Apache config parser

Attempting to run letsencrypt, it bombs out, failing to parse my Apache config:

Traceback (most recent call last):
  File "/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/letsencrypt/plugins/disco.py", line 103, in prepare
    self._initialized.prepare()
  File "/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/letsencrypt_apache/configurator.py", line 150, in prepare
    self.check_parsing_errors("httpd.aug")
  File "/root/.local/share/letsencrypt/local/lib/python2.7/site-packages/letsencrypt_apache/augeas_configurator.py", line 68, in check_parsing_errors
    raise errors.PluginError(msg)
PluginError: ('There has been an error in parsing the file (%s): %s', u'/etc/apache2/sites-enabled/foobar.org.conf', u'Syntax error')

Apache thinks my config is valid:

# apachectl configtest
Syntax OK

It turns out the problematic line is this one:

RewriteCond %{HTTP_HOST} !=""

As far as I can tell, this is valid syntax if I’m not misreading the Apache 2.4 mod_rewrite documentation.

Let’s Encrypt uses Augeas for the configuration file parsing. Perhaps you could have a look at the httpd.aug (original here) file why it doesn’t parse that particular directive? I myself don’t have any clue about Augeas lenses or what they are all about :stuck_out_tongue: